Combining REMOTE_ADDR and X-Forwarded-For in apache access_log

A great and simple solution to combine the reverse proxy log into access_log

SetEnvIf REMOTE_ADDR “(.+)” CLIENTIP=$1
SetEnvIf X-Forwarded-For “^([0-9.]+)” CLIENTIP=$1
LogFormat “%{CLIENTIP}e %D %u %t \”%r\” %>s %O \”%{Referer}i\” \”%{User-Agent}i\”” trueip_combined

For details: http://blog.grahampoulter.com/2011/10/how-to-log-client-ip-from-apache-behind.html

Leave a Reply