Amazon CloudWatch Logs enables you to monitor, store, and access log files from AWS CloudTrail, Amazon EC2 instances, CloudWatch, and other sources. You can use CloudWatch Logs to troubleshoot application issues by:
Example: Querying logs using CloudWatch Logs Insights to find errors:
fields @timestamp, @message
| filter @message like /ERROR/
| sort @timestamp desc
| limit 20
This query filters log events that contain the keyword "ERROR" and sorts them by timestamp in descending order, showing the most recent 20 entries.
- Aggregating logs from multiple sources for centralized management.
- Setting up metric filters to create CloudWatch metrics based on log data.
- Analyzing log data in real-time with CloudWatch Logs Insights.