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.
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.
Since the link in your comment is broken, here's how to log visitors' IP addresses:
In httpd.conf, create a new log format:
Then to use it:
It's that simple.