Skip to content

What scenarios increment metric HTTPCode_ELB_4XX of ec2 classic load balancer?

0

Hi, I created my clb (classic load balancer) on ec2, and connected healthy instances to it. I requested my clb dns and everything worked fine.

However I noticed that when I requested my clb dns with a request that has an unsupported method type my clb returned "405 Method Not Allowed", but in Monitoring tab for my clb where there are graphs with different metrics of clb, one of the metrics: HTTPCode_ELB_4XX didn't increment. I noticed that when I'm making requests to clb that take too long, clb responds with "408 Request Timeout", but metric: HTTPCode_ELB_4XX also didn't increment. I noticed that HTTPCode_ELB_4XX is also not changing when my clb returns 400 Bad Response.

Therefore my question is what scenarios increment metric HTTPCode_ELB_4XX of ec2 classic load balancer?

Because from what I've noticed this metric is not incremented at all when clb returns any of the 4xx errors.

Situations when health check for lb instance failed (curl to my load balancer returned 503 status) incremented similiar metric HTTPCode_ELB_5XX, because i noticed these changes in my Monitoring metrics tab of my clb.

asked 6 months ago161 views
1 Answer
-1

The HTTPCode_ELB_4XX metric for Classic Load Balancers is incremented when the load balancer itself generates 4XX error codes in response to client requests. Based on your observations, it seems there might be a discrepancy between what you're experiencing and how the metric should work.

According to AWS documentation, the HTTPCode_ELB_4XX metric should increment in the following scenarios:

  1. When the load balancer receives a malformed request
  2. When a client sends a request with the HTTP CONNECT method (which is not supported)
  3. When the length of the method in an HTTP request exceeds 127 characters (resulting in HTTP 405)
  4. When a client cancels a request or there's a network interruption (resulting in HTTP 408)

The metric is reported to CloudWatch and should be visible in the monitoring tab. When these errors occur, the load balancer sends the HTTP code to the client, saves the request to the access log, and increments the HTTPCode_ELB_4XX_Count metric.

For Application Load Balancers (which are different from Classic Load Balancers), these metrics are explicitly tracked as HTTPCode_ELB_4XX_Count.

If you're not seeing the metric increment despite receiving 4XX errors, you might want to:

  1. Verify that you're looking at the correct metric in CloudWatch
  2. Check if there's a delay in metric reporting
  3. Ensure that the errors are actually being generated by the load balancer itself and not by your backend instances

For troubleshooting purposes, you can also check CloudWatch logs for more detailed information about the errors.
Sources
Troubleshoot a Classic Load Balancer: Response code metrics - Elastic Load Balancing
Troubleshoot a Classic Load Balancer: HTTP errors - Elastic Load Balancing
Troubleshoot your Application Load Balancers - Elastic Load Balancing
CloudWatch metrics for your Classic Load Balancer - Elastic Load Balancing

answered 6 months ago
  • It's not true, documentation says it should increment this metric, but when i recreated situations u mentioned on a running aws classic load balancer, value of HTTPCode_ELB_4XX still did not increment.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.