Skip to main content

CloudWatch & Sentry

Log Groups

Log GroupSource
/aws/ec2/statux-prodEC2 instance logs
/aws/ec2/statux-prod-pages-apiStatux Pages API container logs
/aws/ec2/statux-prod-alerts-apiAlerting API container logs
/aws/ec2/statux-prod-synthetics-apiSynthetics API container logs
/aws/ec2/statux-prod-insights-apiInsights API container logs
/aws/ec2/statux-prod-platform-apiPlatform API container logs

View Logs

# Follow logs for a specific API
aws logs tail /aws/ec2/statux-prod-alerts-api --follow

# Search for errors
aws logs filter-log-events \
--log-group-name /aws/ec2/statux-prod-alerts-api \
--filter-pattern "ERROR"

You can also view container logs directly on the EC2 instance:

# SSH via SSM, then:
sudo docker logs --tail 100 <container-id> 2>&1 | grep -i error

CloudWatch Alarms

AlarmThresholdAction
ASG Max Capacity>= 2 instancesSNS notification
SES Bounce Rate> 5%SNS notification
SES Complaint Rate> 0.1%SNS notification

Sentry Error Tracking

All 5 APIs report 500+ errors to Sentry automatically:

  • Sentry project: allstatux (single project for all APIs)
  • How it works: HttpExceptionFilter (applied globally) calls captureException() for any error with status >= 500, including request context (URL, method, user ID)
  • Initialization: Each API calls initSentry() in main.ts with the DSN from Secrets Manager

Sentry Dashboard

View errors, stack traces, and trends at the Sentry web dashboard. Errors are tagged with the service name (e.g., alerting-api, statuspages-api) for filtering.

When to Use What

ScenarioTool
Application errors (500s, exceptions)Sentry
Container startup issues, crashesCloudWatch Logs
Infrastructure metrics (CPU, memory)CloudWatch Metrics
Email delivery issuesCloudWatch Alarms (SES bounce/complaint)
API request debuggingCloudWatch Logs + Sentry

SES Monitoring

AWS SES email delivery is monitored via CloudWatch:

  • Bounce rate alarm triggers if bounces exceed 5% (SES suspension risk at 10%)
  • Complaint rate alarm triggers if complaints exceed 0.1% (SES suspension risk at 0.5%)
  • SES configuration set statux-production-v2 routes delivery events to CloudWatch