X-Forwarded-For and Cookie in Apache Config

Avatar
  • Answered
We have added X-Forwarded-For and Cookie to our Apache Config. Is there a way to get them to show in the report statistics somewhere? Here is our config:

LogFormat "%h %l %u %t \"%m \"%V\" \"%U\" \"%q\" %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\" \"%{X-Forwarded-For}i\"" combined

X-Forwarded-For is passed to web server via F5 device.

Thanks,

Matt
Avatar
Matthew Huth
I had thought about something like what you had but wasn't what to use for the F5 IP address. Using %l again at beginning is good. This looks like it will work, thanks.

Much appreciated.
Avatar
Michael
WebLog Expert doesn't support reporting on cookies, so this field is ignored.

The X-Forwarded-For field is also ignored by default for Apache logs now. However, if you wish to use this field values instead of IPs specified in the %h field (e.g. if this field contains the IP of the load balancer), you can specify the following format in the WebLog Expert profile properties:

%l %l %u %t \"%m \"%V\" \"%U\" \"%q\" %H\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{Cookie}i\" %h

So in this case the program will read the visitor IPs from the last field instead of the first one.
Avatar
Michael
We have added support for the X-Forwarded-For field in Apache logs in version 8.3 beta, so now you can simply enter your log format as it is specified in Apache config without need to change it.