Excluding Load Balancers and Localhost from Apache Access Logs


In httpd.conf add


# Exclude localhost

SetEnvIf Remote_Addr "127.0.0.1" dontlog

# Exclude Test Load Balancer 1

SetEnvIf Remote_Addr "192.168.5.60" dontlog

# Exclude Test Load Balancer 2

SetEnvIf Remote_Addr "192.168.5.80" dontlog


Then in each Virtual Host Custom or the main Custom log entry depending on how you've configured logging append with env=!dontlog as shown below:


CustomLog /log/www-access_log combined env=!dontlog

No comments: