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
Related videos on Youtube
Author by
rubo77
Updated on September 18, 2022Comments
-
rubo77 almost 2 years
I have an old server running online with over 250 sites on it I am not sure, but maybe too many logfiles in the apachelog are slowing down the server?
Now since I don't need the Apache logs, How do I disable all logging completely?