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!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Exclude 'internal dummy connection' entries in apache access log

Discussion in 'EasyApache' started by morrow95, Jun 28, 2017.

  1. morrow95

    morrow95 Well-Known Member

    Joined:
    Oct 8, 2006
    Messages:
    106
    Likes Received:
    2
    Trophy Points:
    168
    So here is what is going on. I have a folder of php scripts that are accessed constantly (apache is serving 70 - 100 requests/sec - they are accessed a lot. I've been going through and removing the logging for this folder to prevent additional resources being used.

    1 - I have excluded these specific scripts from showing in their respective access log (/usr/local/apache/domlogs/example.com AND /usr/local/apache/domlogs/example.com-ssl_log).

    2 - I changed suphp.conf from info to warn (info creates a new entry for every single access)

    3 - Here is where I am having trouble accomplishing what I want to do......

    My /var/log/apache2/access_log has tons of lines like this :

    ::1 - - [28/Jun/2017:02:09:56 -0400] "OPTIONS * HTTP/1.0" 200 - "-" "Apache/2.4.25 (cPanel) OpenSSL/1.0.1e-fips mod_bwlimited/1.4 (internal dummy connection)"

    I'm talking anywhere from every second to every 10 seconds. I want to exclude those from being written. I found some information on the web about doing this by modifying the httpd.conf (or in this case I would be editing an include file so it is not overwritten when cpanel updates).

    My /usr/local/apache/conf/httpd.conf shows the following for the logging section :

    <IfModule mod_log_config.c>
    LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combinedvhost
    <IfModule logio_module>
    LogFormat "%v %{%s}t %I .\n%v %{%s}t %O ." bytesvhost
    </IfModule>
    LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%v:%p %h %l %u %t \"%r\" %>s %b" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent
    <IfModule logio_module>
    CustomLog "|/usr/local/cpanel/bin/splitlogs --main=host.example.com --suffix=-bytes_log" bytesvhost
    </IfModule>
    CustomLog "|/usr/local/cpanel/bin/splitlogs --main=host.example.com --mainout=/etc/apache2/logs/access_log" combinedvhost
    </IfModule>

    What I have tried to do is add the following in the pre virtual host include in Apache Global Config of WHM (all scenario solution) :

    SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
    SetEnvIf Remote_Addr "::1" dontlog
    SetEnvIf User-Agent ".*internal dummy connection.*" dontlog
    CustomLog "|/usr/local/cpanel/bin/splitlogs --main=host.example.com --mainout=/etc/apache2/logs/access_log" combinedvhost env=!dontlog

    I still get the internal dummy connection entries added in the access log after restarting apache. How can I exclude these from being added in?
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    38,658
    Likes Received:
    1,425
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    You may need to customize the EasyApache 4 template files to make these changes, similar to how it's done on the following thread:

    SOLVED - Global Log

    Thank you.
     
Loading...

Share This Page