disable and turn off the Apache logging

comments Comments Off on disable and turn off the Apache logging
By , November 1, 2010 6:55 PM

In order to disable and turn off the Apache logging, just comment out the log lines in the Apache configuration file, httpd.conf, which normally located in /etc/httpd/conf, /etc/apache/conf, /etc/apache2/conf, \usr\local\apache\conf or \usr\local\apache2\conf directory.

In httpd.conf, the logging is defined by a CustomLog directive for access logs and an ErrorLog directive for error logs. For example,

CustomLog /usr/local/apache/logs/access_log common
ErrorLog “logs/error_log”

Commenting out the line by adding # (hash, pound or number sign) to the front of the line. To disable logging of access log, comment the line of CustomeLog, and likewise, comment the line of ErrorLog to disable logging of error log. Restart the Apache web server for the change to take effect.

Note: CustomLog and ErrorLog are also been defined within VirtualHost declaration too for logging the activity of particular virtual host. Disabling logging for virtual hosts only may cause the log information been written to main Apache log files.

there were TWO CustomLog directive specifying access log files, so be sure you scan the entire httpd.conf before saving.

If you comment out the VirtualHost access_log and error_log, then it will write it to the server main log. A better way is to send it to /dev/null

ErrorLog /dev/null
AccessLog /dev/null

This way, the logs are not taking up processes on the server and it’s going to be faster.

Thomas Challenger Thomas Challenger