I run a high-traffic site and I need to reign in my Apache2 access logs a bit. One way to do this, I've read, is to limit the types of things Apache2 logs. The obvious choice would be, to limit 3 types of requests:
- Requests made by bots
- Requests for images, js files, and css (I'm only interested in the page request. Not ALL the assets)
- Requests made by localhost (the web server itself)
I am running the Apache2 mod setinf but it doesn't look like any of my changes take affect when I
tail -f my access log. I'm also running cronolog (if that matters) as a log rotator. Here's what is in my VirtualHost conf:
# LogLevel warn # Variable is_local_referrer = requests made by the server itself SetEnvIfNoCase Referer "^http://*.mysite.com/" is_local_referrer # Variable dont_log = standard file requests SetEnvIf Request_URI ".(jpg|jpeg|png|css|gif|ico|js)$" dont_log # Variable is_a_robot = user agent is a robot SetEnvIfNoCase User-Agent Robot is_a_robot ErrorLog "|/usr/bin/cronolog /home/me/public/mysite.com/log/error_%Y_%m.log" CustomLog "|/usr/bin/cronolog /home/me/public/mysite.com/log/access_%Y_%m.log" combined env=!is_local_referrer|!dont_log|!is_a_robot
Again, when I tail /usr/bin/cronolog /home/me/public/mysite.com/log/access_X_X.log Apache2 is logging every single request.