cloudwatch_get_log_events
Fetch and aggregate AWS CloudWatch log events within a specified time range, with optional filtering and server-side ranking by client IP, status, or URI.
Instructions
Fetch recent events from a CloudWatch log group within the last N hours, with an optional filter pattern. Set group_by (clientIp|status|uri) to get a server-side ranked summary (top_n, default 20) instead of raw lines — avoids dumping huge log pulls. summary_only returns just the event count.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| log_group | Yes | CloudWatch log group name. | |
| hours_back | No | How many hours back to search. | |
| filter_pattern | No | CloudWatch Logs filter pattern (optional). A bare literal (an IP, a path) is auto-quoted so it matches reliably; JSON/space-delimited patterns are passed through untouched. | |
| client_ip | No | Convenience: build the structured WAF/ALB selector { $.httpRequest.clientIp = "x" } for this IP. Overrides filter_pattern. | |
| region | No | AWS region (optional). | |
| max_events | No | Maximum events to return (0 = unlimited, capped at 50000). | |
| group_by | No | Aggregate the events by this structured field and return a ranked summary. | |
| top_n | No | When group_by is set, how many top entries to return (0 = default 20). | |
| summary_only | No | Return only the event count, not raw lines. |