Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Provide error message from aws CloudWatch alarm

When I create an Error alarm for my aws lambda function through CloudWatch alarm notification and this alarm is getting triggered, the email message that I receieve is simply states that error have occured. In order for me to see the error, I need to login to aws, go to CloudWatch's specific log stream and try to find what's the error.

I am wondering if there's a way to setup CloudWatch notifications to include the actual error message when sending alarm notifications.

like image 649
John Walter Avatar asked Apr 18 '17 01:04

John Walter


1 Answers

CloudWatch alarms don't support any kind of log message integration, they're only concerned with the metric they are configured to monitor.

What you could do, is have your CloudWatch alarm trigger an Lambda function instead of the SNS Email notification.

Your Lambda function, would submit an API call to CloudWatch logs and filter out some logs however you see fit, and would then send you an email, with the details of the fired alarm and the logs.

like image 182
mickzer Avatar answered Sep 28 '22 03:09

mickzer