Prevent apache from logging particular requests

If you don’t want apache to log every request in your access.log, maybe because you have thousands of requests from your monitoring system, you can prevent apache from logging these requests by two simple statements:

First you set an environment variable, second you don’t log when this variable is set:

SetEnvIf Remote_Host no_logCustomLog /var/log/apache2/access.log combined env=!no_log

There are more than just IP address matches, look into the apache documentation!

Leave a Reply