简体   繁体   中英

How do you log serverless errors to cloudwatch?

I am using serverless to create lamda functions on aws. I would like any unhandled errors to go to cloudwatch.

How can I set this up? I have tried using winston - but I cannot use a process.on unhandled errors (serverless seems to overide my handling and exiting the code)

Just a simple console.log() should have your logs showing up in Cloudwatch. You can also click on the monitoring tab in AWS to access Cloudwatch.

This should help: https://docs.aws.amazon.com/lambda/latest/dg/monitoring-cloudwatchlogs.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM