Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

It appears my Amazon Elastic Load Balancer is allocating traffic to EC2's, but without their IP addresses?

Is this usual behaviour? It's incredibly annoying. I.e. ELB CName is on my domain name DNS, I hit the domain and access log has the IP address of the ELB, not the visitor.

share|improve this question
Ok, again - found it.... for those searching on this... – waxical Oct 25 '11 at 17:40

If you're running ELB in HTTP mode, it adds some HTTP headers to the request sent to the EC2 instances, amongst which is the X-Forwarded-For header which will contain the IP address of the client.


Note that this header can potentially contain more than one IP if other load balancers or proxies handled the request. In this case you want to extract the first IP listed.

share|improve this answer

Since the link in your comment is broken, here's how to log visitors' IP addresses:

In httpd.conf, create a new log format:

LogFormat "%{X-Forwarded-For}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"" combined-elb

Then to use it:

CustomLog logs/access_log combined-elb

It's that simple.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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