2

I have the following in my httpd.conf file, in order to exclude the url from being logged as it is a status checker:

SetEnvIf Request_URI "^/status_check.php$" dontlog=1
CustomLog "logs/access_log" combined env=!dontlog

However this is not stopping the status_check URL being logged. I have also tried various variants including:

SetEnvIf Request_URI "^/status_check\.php$" dontlog=1
SetEnvIf Request_URI "^/status_check\.php" dontlog=1
SetEnvIf Request_URI "/status_check\.php" dontlog=1
SetEnvIf Request_URI "/status_check.php" dontlog=1
SetEnvIf Request_URI "/^status_check.php" dontlog=1
SetEnvIf Request_URI "/^status_check.php$" dontlog=1

Also with just dontlog at the end without the '=1' part.

However none seem to work. I should explain the site runs on the following physical path: /var/www/vhosts/site_name

Could someone explain please what I am doing wrong? It's driving me mad.

Many Thanks

ianv
  • 105
  • 1
  • 8
  • Looks fine to me. Just to be _really_ certain: you _did_ make sure that this code 1. does _not_ create entries in your error log file and 2. is actually loaded upon server startup? – arkascha Jan 06 '17 at 14:10
  • Hey, thanks for the reply. It is definitely being loaded on startup, and entries definitely are still being created. :( – ianv Jan 06 '17 at 14:26
  • With "entries in your error log file" I meant entries referring to the issue at hand. You now say there _are_ entries in the error log file? Well, what _are_ those? – arkascha Jan 06 '17 at 14:27
  • Sorry missed the word 'error' in your reply. No error entries, but still getting the URL logged in the normal access log. The conf file edited is definitely the one being loaded, httpd -V reveals: -D SERVER_CONFIG_FILE="conf/httpd.conf" – ianv Jan 06 '17 at 14:32
  • Ok, but that does not automatically mean that these lines get applied. Try placing a definite syntax error in there. Do you really get an error then? – arkascha Jan 06 '17 at 14:43
  • Yes I do. If I put some random text in the file and try to restart apache using 'apachectl restart' then I get "AH00526: Syntax error on line 224 of /etc/httpd/conf/httpd.conf: Invalid command 'fishy', perhaps misspelled or defined by a module not included in the server configuration" So is definitely the file being loaded. – ianv Jan 06 '17 at 15:21
  • 1
    OK - found it. The httpd.conf file loaded additional conf files from a conf.d directory. one of these was vhosts.cinf that overrides the logging. Adding the lines in there and it all now works. Server had been configured by a 3rd party so this is what caught me out. Thanks for taking the time though. Cheers – ianv Jan 06 '17 at 15:45

0 Answers0