Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I must be missing something here

If I use this ruleset:

SetEnvIf Remote_Addr "::1" loopback
SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
CustomLog logs/access_log combined env=!loopback

SetEnvIf Request_URI "^/img/" env=images
CustomLog logs/error_log combined env=!images

I end up with localhost requests in my error_log, which I don't want AND I still have images shown too.

This always gives me an syntax error message, apparently you can't have more than the 'env' variable defined?

SetEnvIf Remote_Addr "::1" loopback
SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
CustomLog logs/access_log combined env=!loopback

SetEnvIf Request_URI "^/img/" images=1
CustomLog logs/error_log combined images=!1

I tried this trick:

SetEnvIf Remote_Addr "::1" loopback
SetEnvIf Remote_Addr "127\.0\.0\.1" loopback
CustomLog logs/access_log combined env=!loopback

SetEnvIf Remote_Addr "::1" images
SetEnvIf Remote_Addr "127\.0\.0\.1" images
SetEnvIf Request_URI "^/img/" images
CustomLog logs/error_log combined env=!images

From here:

http://www.tek-tips.com/viewthread.cfm?qid=276232&page=198

But I still see image requests in my logs.

Does anyone have any other methods I could use to filter failed (or even all) image requests of this type?

File does not exist: ..../public_html/agility/img/4thjuly/earth.png,
share|improve this question

1 Answer 1

Request_URI "^/img/" means that the URI begins with img, so the request /public_html/agility/img/4thjuly/earth.png still be logged. Try this:

SetEnvIf Request_URI "(.*)/img/*" images
CustomLog logs/error_log combined env=!images
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.