I'm creating a Probot app using the sample code, like so:
const {
createLambdaFunction,
createProbot,
} = require("@probot/adapter-aws-lambda-serverless");
const appFn = require("./");
exports.handler = createLambdaFunction(appFn, {
probot: createProbot(),
});
My NODE_ENV is set to production, which sets the pino logging output to JSON, which is logged to AWS CloudWatch.
Update: The environment variable is set, but the logging is not JSON; it's still pretty print.
However, the logs are missing some key pieces of information that I'd like to inject. Specifically: the AWS Request ID, CloudFront (or API Gateway) headers/trace IDs, and GitHub event IDs.
I found this issue that proposes something like:
const logger = pino.child({
awsRequestId: context.awsRequestId,
})
But I can't figure out where to overwrite (or modify) the pino logger that Probot has already created.
Any ideas on where we could inject this additional info to make Lambda logs more useful?
I'm creating a Probot app using the sample code, like so:
My
NODE_ENVis set toproduction, whichsets the pino logging output to JSON, which is logged to AWS CloudWatch.Update: The environment variable is set, but the logging is not JSON; it's still pretty print.
However, the logs are missing some key pieces of information that I'd like to inject. Specifically: the AWS Request ID, CloudFront (or API Gateway) headers/trace IDs, and GitHub event IDs.
I found this issue that proposes something like:
But I can't figure out where to overwrite (or modify) the pino logger that Probot has already created.
Any ideas on where we could inject this additional info to make Lambda logs more useful?