How do i exclude img files from my apache access log? I can't get it to work. I have tried to add this
## flag robots.txt requests
SetEnvIf Request_URI "^/robots\.txt$" robots-request=log
## flag favicon requests
SetEnvIf Request_URI "^/favicon\.ico$" favicon-request=nolog
## flag image requests
SetEnvIf Request_URI "(\.gif|\.png|\.jpg)$" image-request=nolog
## flag Css and JS requests
SetEnvIf Request_URI \.css css-request=nolog
SetEnvIf Request_URI \.js js-request=nolog
## flag cron calls
SetEnvIf Request_URI "(^/cron\.php|^/bgp-start/)" cron-request=nolog
## set do_not_log if any of the above flags are set
SetEnvIf robots-request nolog do_not_log
SetEnvIf favicon-request nolog do_not_log
SetEnvIf image-request nolog do_not_log
SetEnvIf css-request nolog do_not_log
SetEnvIf js-request nolog do_not_log
SetEnvIf cron-request nolog do_not_log
I added this to my apache2.conf
Add directives SetEnvIf and CustomLog to vhost configuration, such as:
<VirtualHost *:80>
ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn
SetEnvIf Request_URI "\.png$|\.gif$|\.jpg$|\.js$|\.css$" is_exclude
CustomLog ${APACHE_LOG_DIR}/access.log combined env=!is_exclude
</VirtualHost>