Exclude 'internal dummy connection' entries in apache access log

morrow95

Well-Known Member
Oct 8, 2006
164
8
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?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,909
2,228
463
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.