-
Notifications
You must be signed in to change notification settings - Fork 76
Open
Description
This is a Bug Report
Description
We switched from Winston to use your logger because it has many features we need out of the box. But then we realized that the loggings are not pure JSON anymore.
- What went wrong?
Logs ingested into CloudWatch from our lambda which uses power-logger are not pure JSON. There is a row of plaintext metadata at the beginning of each log entry.
Implementation:
import log from '@dazn/lambda-powertools-logger'
log.info('foo', { bar: 'jar' })
will result in CloudWatch log like:
2020-12-03T09:59:57.754Z 4220ab3e-0559-4a5f-a318-d7b33be19925 INFO
{
"message": "foo",
"data": {
"bar": "jar"
},
"awsRegion": "eu-west-1",
"functionName": "my-function",
"functionVersion": "$LATEST",
"functionMemorySize": "192",
... etc. metadata
}
- What did you expect should have happened?
Only JSON
{
"message": "foo",
"data": {
"bar": "jar"
},
"awsRegion": "eu-west-1",
"functionName": "my-function",
"functionVersion": "$LATEST",
"functionMemorySize": "192",
... etc. metadata
}
should've been logged into CloudWatch.
- Workaround
We forked the lambda-powertools-logger to explicitly log intoprocess.stdout/.stderr. Could probably open a PR if your intention is to log pure JSON?
Additional Data
- Which powertool package are you using?: lambda-powertools-logger
- Which version are you using?: lambda-powertools-logger: 1.24.1
- Middy engine version you're using: 1.4.0
- Operating System: Lambda runtime Node 12.x
hessuhoo, sga-Yuta-B-Sudo, davelosert and kimifoud
Metadata
Metadata
Assignees
Labels
No labels