7

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?

2 Answers 2

8

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
5

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
1
  • NO, # Define an access log for VirtualHosts that don't define their own logfile
    – defim
    Dec 27, 2022 at 15:15

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .