Good morning from Sweden 
We've decided to use mod_remoteip instead of mod_rpaf to translate the XFF header (apache 2.4)
However, mod_remoteip uses the %a log format instead of the %h to get the client IP. If there is no XFF header then %a (or if it's not trusted) then %a equals %h.
So, this is fixable in httpd.conf by changing these %h into %a.
so they'll be like this:
However, after distilling and rebuilding httpdconf, one of the entries above reverts to %h:
That's of course the logformat that controls virtual host logs.
I've had this issue up with cPanel twice already during the last year. They couldn't solve it and asked me to file a feature request.
I've since added the whole part of the config in /usr/local/apache/conf/includes/pre_virtualhost_global.conf to overwrite the incorrect one, but it feels like a hack (since cPanel could change the template in the future or decide to move the splitlogs binary).
Has anyone else solved it in a better way? Care to share how?
We've decided to use mod_remoteip instead of mod_rpaf to translate the XFF header (apache 2.4)
However, mod_remoteip uses the %a log format instead of the %h to get the client IP. If there is no XFF header then %a (or if it's not trusted) then %a equals %h.
So, this is fixable in httpd.conf by changing these %h into %a.
Code:
<IfModule mod_log_config.c>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedvhost
LogFormat "%v %{%s}t %I .\n%v %{%s}t %O ." bytesvhost
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog "|/usr/local/cpanel/bin/splitlogs --main=box01.oderland.com --suffix=-bytes_log" bytesvhost
CustomLog "|/usr/local/cpanel/bin/splitlogs --main=box01.oderland.com --mainout=/usr/local/apache/logs/access_log" combinedvhost
</IfModule>
Code:
<IfModule mod_log_config.c>
LogFormat "%v:%p %a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedvhost
LogFormat "%v %{%s}t %I .\n%v %{%s}t %O ." bytesvhost
LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%a %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog "|/usr/local/cpanel/bin/splitlogs --main=box01.oderland.com --suffix=-bytes_log" bytesvhost
CustomLog "|/usr/local/cpanel/bin/splitlogs --main=box01.oderland.com --mainout=/usr/local/apache/logs/access_log" combinedvhost
</IfModule>
Code:
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedvhost
I've had this issue up with cPanel twice already during the last year. They couldn't solve it and asked me to file a feature request.
I've since added the whole part of the config in /usr/local/apache/conf/includes/pre_virtualhost_global.conf to overwrite the incorrect one, but it feels like a hack (since cPanel could change the template in the future or decide to move the splitlogs binary).
Has anyone else solved it in a better way? Care to share how?