Split apache access log

From snippet wiki
Jump to navigation Jump to search

If you need a clean view of access patterns in you apache access log, you might want to get rid of all those image and css requests.

Just add these lines to your virtual host apache configuration and you get two seperate log files, one for media and one for the rest. Nothing will be lost.

SetEnvIf Request_URI \.(gif|jpg|png|css|js)$ media-file
CustomLog /var/logs/media.log combined env=media-file
CustomLog /var/logs/access.log combined env=!media-file