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?


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
|improve this answer|||||

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



or disable this config file:

sudo a2disconf other-vhosts-access-log
|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for?Browse other questions tagged or ask your own question.