Disable Apache Access Log

Posted on July 24, 2013 at 8:48 am

Apache web server has the option (enabled by default) to log comprehensive and detailed activity, performance, and error messages about its operation to a log file. While logging error messages is useful for system administrators to troubleshoot possible the errors that may occur, the logging of the access of all visitors may be not needed in some cases, such as when a website has a lot of traffic or if you want to optimize the page loading and reduce the IO requests to disk.

There are two ways to disable access logging in Apache:

a) Redirect logs to /dev/null device

Edit the file of your Virtual Host and change:

CustomLog /var/www/apache2/logs/website.com-access.log combined

To:

CustomLog /dev/null combined

Reload Apache to update the settings:

/etc/init.d/apache2 reload

b) Comment lines

Edit the file of your Virtual Host and change:

CustomLog /var/www/apache2/logs/website.com-access.log combined

To:

#CustomLog /var/www/apache2/logs/website.com-access.log combined

Edit the file related to other_vhosts_access located in:

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

Change this line:

CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined

To:

#CustomLog ${APACHE_LOG_DIR}/other_vhosts_access.log vhost_combined

Reload Apache to update the settings:

/etc/init.d/apache2 reload

Updated on October 22, 2013 at 4:10 pm

Receive updates via email

Other Posts

Updated Posts