Quote:
Originally Posted by andrew777
When apache creates entries in the log file (/var/log/httpd/www...) it includes all the pictures accessed on a web page as well as the html and other stuff.
I have a huge site with over 10 million pages and growing, and high traffic. My log file is now 2 gig and growing. 90% of the content of the log file are entries for each image downloaded per session.
Logging every little image downloaded from my site just wastes space and it is of no importance to me.
Is there any way to tell apache to omit logging images files or files of a certain type? This will reduce the size of my log file dramatically.
Thanks for your help.
Andy
|
The "conditional logging" in Apache might be what you're after:
http://httpd.apache.org/docs/1.3/logs.html#conditional
From the docs:
Code:
# Mark requests from the loop-back interface
SetEnvIf Remote_Addr "127\.0\.0\.1" dontlog
# Mark requests for the robots.txt file
SetEnvIf Request_URI "^/robots\.txt$" dontlog
# Log what remains
CustomLog logs/access_log common env=!dontlog
So, you could probably add something like
Code:
SetEnvIf RequestImg "^.jpg" dontlog
maybe. Never actually tried it, but have adjusted my Apache logs before.