-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: GuLambdaFunction should use JSON logging by default #2260
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to double check - does https://github.com/guardian/cloudwatch-logs-management apply the log markers to JSON format logs?
It seems like it to me. Here's a link to the repocop logs, which have been using JSON formatting for months. |
3e42224
to
bb8f340
Compare
What does this change?
I think JSON log formatting is a more sensible default value.
There are two log formats in AWS Lambda,
Text
, andJSON
.Text
is the default (possibly for historical reasons?), but has disadvantages, such as not being as easily machine-readable.Using
Text
means that any changes made to the ApplicationLogLevel will be flat out ignored (defaulting toDEBUG
as far as I can tell). Application log filtering only works when the log format isJSON
.I've verified that Lambdas using this configuration are still compatible with Central ELK. Repocop has been using JSON logging for several weeks without issue.
How to test
Text
value results in the expected snapshotHow can we measure success?
Teams will be able to filter their application logs by severity level without having to do as much googling/asking around as I had to
Have we considered potential risks?
This will cause snapshot changes to everyone using a GuLambdaFunction or its descendants. This will be slightly disruptive, but no work is required beyond updating the snapshot tests.
To maintain the previous behaviour, users should add the following to their lambda props
logFormat: "Text"
Checklist
Footnotes
Consider whether this is something that will mean changes to projects that have already been migrated, or to the CDK CLI tool. If changes are required, consider adding a checklist here and/or linking to related PRs. ↩
If you are adding a new construct or pattern, has new documentation been added? If you are amending defaults or changing behaviour, are the existing docs still valid? ↩