Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

SOLVED EasyApache master/custom/global access log

Discussion in 'EasyApache' started by luis_h, Aug 27, 2018.

  1. luis_h

    luis_h Registered

    Joined:
    Sep 2, 2015
    Messages:
    4
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    Brasil
    cPanel Access Level:
    Root Administrator
    Hello

    I have tried to reply on this thread but I couldn't because it's too old.
    I'm trying to create a "master" apache access log file, and also keep individual log files.

    Following the instructions, I could set up a "master access log file" and it works ok. But unfortunately, the individual log files are not being generated anymore.

    I have read some mention about this here (by @cPanelMichael ) but I could not understand what should I do to have all logs working.

    I'm using EasyApache4 and piped logs.

    The code that I have updated at /var/cpanel/templates/apache2/vhost.local

    Code:
    ...........
    
    LogFormat "%V %a %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" vcommon
    CustomLog /var/log/httpd/vhost-access_log vcommon
    
    </VirtualHost> 


    and then executed:

    /usr/local/cpanel/scripts/rebuildhttpdconf
    /scripts/restartsrv_httpd


    Any suggestions?

    Thanks

    Sorry, i forget the link on the mention:

     
  2. cPanelMichael

    cPanelMichael Technical Support Community Manager Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    47,325
    Likes Received:
    2,157
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Twitter:
    Hello @luis_h,

    I believe the user-submitted information on the following thread should help you get this setup:

    SOLVED - Global Log

    Let me know if this works.

    Thank you.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    luis_h likes this.
  3. luis_h

    luis_h Registered

    Joined:
    Sep 2, 2015
    Messages:
    4
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    Brasil
    cPanel Access Level:
    Root Administrator
    Thank you @cPanelMichael

    After some tests, here is the entire configuration that I have used to make this work:

    Code:
    cp -a /var/cpanel/templates/apache2_4/ea4_main.default /var/cpanel/templates/apache2_4/ea4_main.local
    Edit /var/cpanel/templates/apache2_4/ea4_main.local

    I have inserted the code, in the section <IfModule mod_log_config.c>
    Code:
            
    LogFormat "%V %a %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"" mycustom
    CustomLog /etc/apache2/logs/combined_apache_accesslog mycustom


    Just on the end of the section, above the existing lines:

    Code:
    CustomLog "|/usr/local/cpanel/bin/splitlogs --dir=[% paths.dir_domlogs %] --main=[% wildcard_safe(servername) %] --mainout=[% paths.file_access_log %][% splitlogsextra %]"$
    </IfModule>
    After, rebuild and restart apache.

    And was just this, only two lines of code. I did not need to use the file: /var/cpanel/templates/apache2/vhost.local
    I works for both, non-ssl and ssl access.
     
    cPanelMichael likes this.
  4. luis_h

    luis_h Registered

    Joined:
    Sep 2, 2015
    Messages:
    4
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    Brasil
    cPanel Access Level:
    Root Administrator
    I forgot to mention, that I have activated the log rotation, using the WHM gui, at
    Home »Service Configuration »Apache Configuration »Log Rotation

    WHM automatically recognized the log file at the logs list.
     
    cPanelMichael likes this.
  5. luis_h

    luis_h Registered

    Joined:
    Sep 2, 2015
    Messages:
    4
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    Brasil
    cPanel Access Level:
    Root Administrator
    cPanelMichael likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice