1

I have an auto-scaling group of EC2 instances running a Wordpress site behind an elastic load balancer. I can see that there are periodic 500 errors being reported by the elastic beanstalk app in Cloudwatch, but they're not coming from the application servers. I can see ELB logs in S3, but they're very laborious to use. Is there any way to log only 5xx errors with information like time, request, exact error code, etc, using Cloudwatch or something similar?

3

Use AWS Athena to analyse the ALB logs. There is a worked example here: https://docs.aws.amazon.com/athena/latest/ug/application-load-balancer-logs.html

You want to look for entries where elb_status_code LIKE '50%'

1
  • Amazing, thanks very much. Final query I used in case it saves anyone else a keystroke: SELECT time, client_ip, elb_status_code, request_verb, request_url, user_agent FROM alb_logs where elb_status_code LIKE '50%' and user_agent != 'AWS Security Scanner' order by time desc LIMIT 100 – Jeremy Warne Nov 11 '19 at 1:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.