1 Answers
1
Accepted Answer
It's possible to trigger a Lambda from based on a matching pattern in the CloudWatch Logs. Instead of using the CloudWatch Logs subscription filters, do the following:
- Create metric filter from your Log group. For Filter Pattern, enter the pattern that you want to capture (in your sample :
Status: **Stopped**
). For more information, see Publishing numerical values found in log entries. - Create an Amazon SNS topic and integrate your Lambda function there. For more information, see Tutorial: Using AWS Lambda with Amazon Simple Notification Service.
- Create CloudWatch Alarm to monitor the metric you created in step #1. For more information, see Create a CloudWatch alarm based on a static threshold.
Keep the following in mind when defining the alarm:
- For Period, select a sufficient time range (Example: 10 seconds).
- For Statistic, select Sum.
- For Threshold type, select Static.
- For Define the alarm condition, select Greater > threshold.
- For Define the threshold value, select 0
- Configure the alarm's action as the SNS topic you created earlier.
Relevant questions
Cloudwatch logs to S3 continuous export
asked 4 months agoCloudwatch Log Insights doesn't find logs from the first Lambda Invocation
asked 2 months agoForward AWS Connect CCP Streams Logs to Cloudwatch
asked 2 months agoHow do I configure an Amazon MQ instance that's in a VPC to invoke a Lambda function?
Accepted Answerasked 2 years agoHow do a trigger a reboot action on lightsail cloudwatch alarm state?
Accepted Answerasked 3 months agoHow to stream CloudFront real time logs to cloudwatch
asked 6 months agoLogs generated by Lambda Functions
asked 2 months agoCan I use CloudWatch Logs to trigger a Lambda function?
Accepted Answerasked 2 years agoWhere are lambda logs?
Accepted AnswerHow can I optimize costs associated with publishing Lambda custom metrics to CloudWatch?
Accepted Answerasked 2 years ago