Disable Apache logging completely

24,270

Solution 1

I disabled all vhosts logging with:

find /etc/apache2/sites-enabled/* -exec sed -i 's/#*[Cc]ustom[Ll]og/#CustomLog/g' {} \;
find /etc/apache2/sites-enabled/* -exec sed -i 's/#*[Ee]rror[Ll]og/#ErrorLog/g' {} \;

and commented out in /etc/apache2/apache2.conf

#ErrorLog ${APACHE_LOG_DIR}/error.log

and added

ErrorLog /dev/null

Restart apache gracefully:

apache2ctl graceful

I have a lot of logs in different places so I can watch the result with

 tail -n 1 -f /var/kunden/logs/*log /var/kunden/logs/*log /var/log/apache2/*log

If you want to enable all logging into one file you can edit /etc/apache2/apache2.conf again and add those lines:

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log  "%h %v %l %u %t \"%r\" %>s %b"

and comment out

#ErrorLog /dev/null

Solution 2

For all who have the other_vhosts_access.log file and want to disable it too, comment out the line:

#CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined

in:

/etc/apache2/conf-available/other-vhosts-access-log.conf

or disable this config file:

sudo a2disconf other-vhosts-access-log
Share:
24,270

Related videos on Youtube

rubo77
Author by

rubo77

Updated on September 18, 2022

Comments