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.
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.