3

I would like to change the logging format for AWS ELB, in order to log the real user IP.

My current server setup contains multiple layers of proxies as followed:

CloudFlare -> AWS ELB -> Nginx (EC2)

With proper nginx modules, I am able to obtain the real client IP in the log of my EC2 instance using the X-Forwarded-For header. However, I am not able to find a way to configure AWS ELB to log the IP in X-Forwarded-For which is set by CloudFlare.

I would like to customize the log entry generated by AWS ELB to log the real user IP, so I can analyze the full log in the future, rather than collect the logs from each EC2 instance.

Is there a way to do that?

2 Answers 2

2

I wrote emails to AWS technical support and they responded that currently ELB does not support such configuration at this point.

1

Use the CF-Connecting-IP header which is set by CloudFlare in your nginx real_ip configuration.

For example:

real_ip_header CF-Connecting-IP;

ELB doesn't seem to have any option to do this. You're almost certainly going to have to aggregate your logs yourself.

4
  • 1
    I am already using this for my nginx(ec2) instance, which works great. My question is how to log the real ip in ELB instead (which should log all connections across EC2 instances)
    – Andy
    Aug 16, 2014 at 0:38
  • ELB doesn't seem to have any option to do this. You're almost certainly going to have to aggregate your logs yourself. Aug 16, 2014 at 0:40
  • I also received an official answer that ELB doesn't support such configuration. Would you like to create another answer so I could mark it? Thanks
    – Andy
    Aug 18, 2014 at 2:27
  • the question is, who stops using ELB directly and fake CF-Connecting-IP header
    – confiq
    Jul 20, 2015 at 7:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .