| name | ops-check-logs |
| description | Check application logs from local Docker Compose or remote AWS CloudWatch environments. Supports local, staging, and production targets. |
| allowed-tools | ["Bash","Read"] |
Check Application Logs
Check logs for the Your Project Rails application in the specified environment.
Target environment: $ARGUMENTS (expected: local, staging, or production)
Workflow
If target is local
-
Verify Docker is running:
docker compose ps
-
Tail recent logs from web and worker:
docker compose logs --tail=50 web
docker compose logs --tail=50 worker
-
If the user needs file-based logs, read log/development.log
-
Summarize any errors, warnings, or notable output
If target is staging or production
-
Set the AWS profile:
- Staging:
your-project-staging
- Production:
your-project-production
-
Check AWS session:
aws sts get-caller-identity --profile <profile>
If expired, run: aws sso login --profile <profile>
-
Discover log groups:
aws logs describe-log-groups \
--profile <profile> \
--region us-east-1 \
--query 'logGroups[].logGroupName' \
--output table
-
Tail recent logs (last 10 minutes by default):
aws logs tail <log-group> \
--since 10m \
--profile <profile> \
--region us-east-1
-
Filter for errors if requested:
aws logs filter-log-events \
--log-group-name <log-group> \
--filter-pattern "ERROR" \
--start-time $(date -v-30M +%s000) \
--profile <profile> \
--region us-east-1 \
--query 'events[].message' \
--output text
-
Summarize findings: error counts, notable patterns, and recommended actions
Execution
Check logs now for the specified environment.