The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Modifying the default Apache log format

Discussion in 'EasyApache' started by spellinn, Aug 31, 2011.

  1. spellinn

    spellinn Member

    Joined:
    Jan 3, 2002
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    1
    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
     
  2. cPanelTristan

    cPanelTristan Quality Assurance Analyst
    Staff Member

    Joined:
    Oct 2, 2010
    Messages:
    7,623
    Likes Received:
    21
    Trophy Points:
    38
    Location:
    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?
     
Loading...

Share This Page