Issue #13: JSON logs appear in Sumo as strings #14
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Details
Address Issue 13: JSON logs appear in Sumo as strings
Currently using the sumo reflector lambda to forward CloudWatch Logs for Lambdas to sumo, log messages which are purely JSON are left as JSON so sumo auto-parse works on them. I found that the reflector specifically looks for JSON logs to handle them accordingly: https://github.com/SumoLogic/sumologic-aws-lambda/blob/90f280daf89d13d7f672101c5b3eec7081713a8b/cloudwatchlogs/cloudwatchlogs_lambda.js#L197-L203
The lambda extension formats all log messages as strings, even if they are JSON, which causes the JSON to have all double quotes escaped, requiring further parsing in queries and making for slower queries.
Description
in enhanceLogs, attempt to marshal log entry body as JSON into a map.
If successful, use the map as the log item message.
If unsuccessful, use the log entry body as a string as the log item message.
Built and deployed to a pre-prod AWS org where I was testing the public published extension, and configured my lambda to use this modified version in the PR, and I see JSON log messages being handled as expected now.
Related Issue
#13
Checklist