SetEnvIf ^X-Forwarded-For$ ^$ noxforward
SetEnvIf Remote_Addr "(.+)" xremote=$1
RequestHeader set X-Forwarded-For %{xremote}e env=noxforward
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v %{X-FORWARDED-FOR}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" commonvhost
# LOG Formats and Settings {{{2
# ================================================================================
SetEnvIf ^X-Forwarded-For$ ^$ noxforward
SetEnvIf ^X-Forwarded-For$ "(.+)" xforwarded=$1
SetEnvIf ^X-Cluster-Client-Ip$ ^$ noxclusterip
SetEnvIf ^X-Cluster-Client-Ip$ "(.+)" xclusterip=$1
SetEnvIf Remote_Addr ^$ noxremote
SetEnvIf Remote_Addr "(10\.183\.253\.48)" noxremote
SetEnvIf Remote_Addr "(.+)" xremote=$1
# If the environment variable specified in the env=... argument exists (or if the environment variable does not exist and env=!... is specified) then the action specified by the RequestHeader directive will take effect.
RequestHeader set X-ISC-IP %{xclusterip}e env=!noxclusterip
RequestHeader set X-ISC-IP %{xclusterip}e env=!noxremote
RequestHeader set X-ISC-IP %{xremote}e env=!xclusterip
LogFormat "%v %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%v %{X-ISC-IP}i %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" commonvhost
Apache Logging for Remote Addresses using X-Forwarded-For - AskApache