From fix-error
Retrieve and query AWS CloudWatch logs using the AWS CLI. Use when you need to fetch log groups, log streams, log events, or run CloudWatch Insights queries to find errors, filter by pattern, or analyze log volume.
How this skill is triggered — by the user, by Claude, or both
Slash command
/fix-error:aws-cloudwatchThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Retrieve logs from AWS CloudWatch using the AWS CLI.
Retrieve logs from AWS CloudWatch using the AWS CLI.
aws sts get-caller-identity
If this fails, the CLI is not configured. Tell the user to run aws configure or aws configure sso and retry. Do not proceed until credentials are confirmed.
Add --region <region> to any command below when logs are in a non-default region.
# All log groups
aws logs describe-log-groups --query 'logGroups[*].logGroupName' --output table
# Filtered by prefix
aws logs describe-log-groups --log-group-name-prefix "/aws/lambda/my-service" \
--query 'logGroups[*].logGroupName' --output table
aws logs describe-log-streams \
--log-group-name "<LOG_GROUP>" \
--order-by LastEventTime \
--descending \
--max-items 10 \
--query 'logStreams[*].{name:logStreamName,last:lastEventTimestamp}'
aws logs get-log-events \
--log-group-name "<LOG_GROUP>" \
--log-stream-name "<LOG_STREAM>" \
--limit 200 \
--query 'events[*].{time:timestamp,msg:message}'
Add --start-time <epoch-ms> and --end-time <epoch-ms> to restrict the window.
aws logs filter-log-events \
--log-group-name "<LOG_GROUP>" \
--filter-pattern "ERROR" \
--start-time $(date -d '1 hour ago' +%s000) \
--end-time $(date +%s000) \
--limit 100
Pattern syntax: "ERROR" (substring), ?"ERROR" ?"WARN" (OR), { $.level = "ERROR" } (JSON field).
Step 1 — Start the query:
aws logs start-query \
--log-group-name "<LOG_GROUP>" \
--start-time $(date -d '1 hour ago' +%s) \
--end-time $(date +%s) \
--query-string 'fields @timestamp, @message
| filter @message like /ERROR|Exception|FATAL/
| sort @timestamp desc
| limit 50'
Save the returned queryId.
Step 2 — Poll for results:
aws logs get-query-results --query-id "<QUERY_ID>"
Re-run until status is Complete. Results are in the results array.
Useful Insights query patterns:
# Top error messages by frequency
fields @message
| filter @message like /ERROR/
| stats count() as hits by @message
| sort hits desc
| limit 20
# Error rate over time
fields @timestamp
| filter @message like /ERROR/
| stats count() as errors by bin(5m)
# Latency p99 (for structured logs with a duration field)
fields @timestamp, duration
| filter ispresent(duration)
| stats pct(duration, 99) as p99 by bin(1h)
# 1 hour ago (seconds)
date -d '1 hour ago' +%s
# 1 hour ago (milliseconds — needed for filter-log-events)
date -d '1 hour ago' +%s000
# Specific time to epoch
date -d '2026-05-04 14:00:00' +%s
On macOS use date -v-1H +%s instead of date -d.
| Pattern | Service type |
|---|---|
/aws/lambda/<env>-<service> | Lambda functions |
/ecs/<cluster>/<service> | ECS tasks |
/aws/apigateway/<api-id> | API Gateway access logs |
/aws/rds/instance/<id>/error | RDS error logs |
<service>-<env> | Custom application groups |
| Action | Permission |
|---|---|
| List log groups | logs:DescribeLogGroups |
| List log streams | logs:DescribeLogStreams |
| Fetch events | logs:GetLogEvents |
| Filter events | logs:FilterLogEvents |
| Insights queries | logs:StartQuery, logs:GetQueryResults |
If you hit AccessDeniedException, tell the user which permission is missing.
--limit when fetching events — unbounded fetches on high-volume groups are slow and expensiveget-log-events is inefficient at scalefilter-log-events time flags, seconds for Insightsnpx claudepluginhub mikask1/fix-error-skill --plugin fix-errorProvides UI/UX resources: 50+ styles, color palettes, font pairings, guidelines, charts for web/mobile across React, Next.js, Vue, Svelte, Tailwind, React Native, Flutter. Aids planning, building, reviewing interfaces.
Fetches up-to-date documentation from Context7 for libraries and frameworks like React, Next.js, Prisma. Use for setup questions, API references, and code examples.