2

I'm trying to set up Cloudwatch alarms to monitor my application running in Amazon ECS. This web application runs in Docker containers, configured as an ECS service behind an application load balancer and inside an autoscaling group that can step up/down the number of running tasks.

I've been looking through the different namespaces and metrics that are available in Cloudwatch but am not seeing quite what I'm looking for. If my application receives starts throwing off a high number of HTTP 5XX errors, I want to know about it. Likewise, if my application were to throw off a high number of HTTP 4XX errors, I want to know about that as well.

I see that there are metrics such as HTTPCode_ELB_4XX_Count and HTTPCode_ELB_5XX_Count on the load balancer, but this is not the same as application monitoring. The documentation for those specific metrics even states "This count does not include any response codes generated by the targets."

Which (if any) metrics will monitor the HTTP codes generated by the targets, in the context of an ECS service or task?

soapergem
  • 9,263
  • 18
  • 96
  • 152
  • which docker logging driver are you using for your containers?. if you use awslogs(CW driver), you could set alarm based on your application events. – Imran Aug 20 '18 at 02:29
  • I am indeed using the awslogs driver to pipe the application logs to a Cloudwatch Log Group, however this doesn't include the HTTP status codes. On the other hand, I also have the access logs on the Load Balancer logging to an S3 bucket. Is there some way to set up Cloudwatch alarms on those? – soapergem Aug 20 '18 at 13:03

1 Answers1

1

If you'r using application load balancer for your application, it's very simple...

  1. Go to ec2-dashboard
  2. targetgroup (which attached to docker containers)
  3. select monitoring tab
  4. there create alarm
  5. and select 4XX or 5XX count
aSemy
  • 5,485
  • 2
  • 25
  • 51
Ashok Reddy
  • 1,060
  • 1
  • 16
  • 28
  • I tried to do what you said but it seems the target group isn't really tracking much data. Here's a screenshot: https://i.imgur.com/CnxF3P5.png So I can create CW alarms on the target group... but they're stuck in the INSUFFICENT_DATA state forever. Does ECS not support this? Or is there some property I need to enable? – soapergem Aug 21 '18 at 18:17
  • send me alarm screenshot – Ashok Reddy Aug 22 '18 at 03:50
  • Yes, here it is. I've blurred out some PII from the image. https://i.imgur.com/qoGYMRd.png – soapergem Aug 22 '18 at 18:16