Skip to content
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

Issue #13: JSON logs appear in Sumo as strings #14

Merged
merged 1 commit into from
Mar 29, 2022

Conversation

surfous
Copy link
Contributor

@surfous surfous commented Mar 23, 2022

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

  • Updated CHANGELOG.md. (didn't find a change log in the project)
  • Ran unit tests locally.

Address Issue 13
SumoLogic#13

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.
@himanshu219 himanshu219 merged commit bb855e4 into SumoLogic:main Mar 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants