Modifying the default Apache log format

spellinn

Member
Jan 3, 2002
21
1
303
I've a cPanel server that sits behind a web cache device, which means all traffic gets logs as being from that device, not the "real" client IP. The device inserts a custom HTTP header with the "real" client IP, so I need to modify the system-wide httpd.conf with this new format.

I've created a main.local file in /var/cpanel/templates/apache2 as per the documentation, but the line for creating the Apache log is :

Code:
LogFormat [% dir.logformat %]
When the conf file is compiled, this is expanded to:

Code:
LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
What I don't know is where dir.logformat originates from, so I can edit this value with the custom HTTP header so it gets compiled correctly into the final .conf

Cheers


Neil
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
You could simply replace the "LogFormat" line in main.local with the actual line you want it to have, so you change it to:

Code:
LogFormat "something here" "something here" combined
Whatever you want to line to say instead. Or, have you tried that and it isn't working on "/scripts/rebuildhttpdconf" command?