You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When writing JSON logs from the lambda (using, for example the AWS Power Tools Logger) the log message in New Relic is not parsed as JSON.
Description
The logs are not getting parsed as JSON because they are not being sent as JSON - they are including the cloudwatch log prefixes (timestamp, requestid, loglevel). The log message, when received in NewRelic looks like:
I was hoping that the newrelic lambda extension would allow me to take advantage of the JSON message parsing functionality, but due to the prefixes (and probably the trailing newline) this does not occur.
Steps to Reproduce
Sending any JSON to NewRelic via the lambda should recreate this problem.
console.log(JSON.stringify({"test": "this should be parsed by newrelic"})
Expected Behavior
JSON logs should be parsed using NewRelic's JSON message parsing functionality. Ideally there would be some configuration that could be toggled to let NewRelic know to expect JSON log messages, so it can remove leading/trailing characters.
I have looked through AWS's own documentation around this but have been unable to find anything that would allow configuration of the lambda console's output.
The text was updated successfully, but these errors were encountered:
Closing this, as it looks like this is an issue with the console.log implementation in lambda itself. For anyone else hitting this, the quick fix is to use something like pino or bunyan instead of console.log.
When writing JSON logs from the lambda (using, for example the AWS Power Tools Logger) the log message in New Relic is not parsed as JSON.
Description
The logs are not getting parsed as JSON because they are not being sent as JSON - they are including the cloudwatch log prefixes (timestamp, requestid, loglevel). The log message, when received in NewRelic looks like:
I was hoping that the newrelic lambda extension would allow me to take advantage of the JSON message parsing functionality, but due to the prefixes (and probably the trailing newline) this does not occur.
Steps to Reproduce
Sending any JSON to NewRelic via the lambda should recreate this problem.
Expected Behavior
JSON logs should be parsed using NewRelic's JSON message parsing functionality. Ideally there would be some configuration that could be toggled to let NewRelic know to expect JSON log messages, so it can remove leading/trailing characters.
I have looked through AWS's own documentation around this but have been unable to find anything that would allow configuration of the lambda console's output.
The text was updated successfully, but these errors were encountered: