I want to export and analyze my Amazon CloudWatch history that's older than two weeks.
Short description
CloudWatch alarms preserve history for 30 days. After 30 days, CloudWatch removes the history from the console. To check your alarm history that's older than 30 days, use Amazon EventBridge. Then, create a rule that captures and sends changes about alarm state events to the CloudWatch log group.
Resolution
To use EventBridge to check history that's older than two weeks, complete the following steps:
- Open the EventBridge console.
- Choose Create rule, and then enter a name for the rule.
- Choose Next.
- For Event source, select AWS events or EventBridge partner events.
- Under Event pattern, choose the following options:
For Event source, select AWS services.
For AWS service, select CloudWatch.
For Event type, select CloudWatch Alarm State Change.
- Choose Next.
- Under Select a target, choose CloudWatch log group.
- For Log Group, choose Existing log group, and then select your CloudWatch log group.
- Choose Skip to Review and create, and then choose Create rule.
When your CloudWatch alarm state changes, the EventBridge rule captures the event and creates a CloudWatch log event. To analyze your log data, see Analyzing log data with CloudWatch Logs Insights.
Related information
CloudWatch Logs Insights language query syntax
Extending and exploring alarm history in Amazon CloudWatch - part 1