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 have a working apache rewrite rule:

RewriteCond %{HTTP_HOST} ^.*foo.com
RewriteRule (.*) http://bar.com$1 [R=301,QSA,L]

and some working dontlog SetEnvIfs:

SetEnvIf Host "allrecallsapp.com" dontlog
SetEnvIf Request_URI "^/server-status$" dontlog
SetEnvIf Request_URI "^/home/ping$" dontlog
SetEnvIf Request_URI "^/haproxy-status$" dontlog
SetEnvIf User-Agent ".*internal dummy connection.*" dontlog
CustomLog /var/log/apache2/access.log combined env=!dontlog
#ErrorLog  /var/log/apache2/error.log

#Remote logging -- handle by syslog
ErrorLog "|logger -p local3.info -t httperror"
CustomLog "|logger -p local3.info -t http" combined env=!dontlog

LogLevel warn

but I can't figure out how to stop the RewriteRule from logging a duplicate line. foo.com and bar.com are both on the same machine. I would expect this rule to work, but it did not:

SetEnvIf Host "foo.com" dontlog

I still get duplicates in the Apache Log:

10.250.18.97 - - [06/Apr/2012:16:57:12 +0000] "GET / HTTP/1.1" 200 732 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3"
68.194.30.42 - - [06/Apr/2012:16:57:12 +0000] "GET / HTTP/1.1" 200 732 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/534.55.3 (KHTML, like Gecko) Version/5.1.5 Safari/534.55.3"

.... where 10.250.18.97 is the server's IP. How can I prevent that RewriteRule from logging?

share|improve this question
    
That's not the redirect; the redirect has a 301 response code. That's the same exact request - are you using ProxyPass or something? –  Shane Madden Apr 6 '12 at 17:05
    
No, I am using HAProxy though, could that be it? –  coneybeare Apr 6 '12 at 17:18
    
Can you clarify how it's configured? It doesn't make sense for it to be logged as coming from both the client IP and the original source IP. Do you maybe have configuration in Apache that's logging the 'real' client IP based on the X-Forwarded-For header? –  Shane Madden Apr 6 '12 at 17:43
    
The box has HAProxy sending requests to apache, which sends requests to several Passenger Rails instances. –  coneybeare Apr 6 '12 at 18:14
    
What's the logging configuration look like? The real client IP is coming from somewhere.. –  Shane Madden Apr 6 '12 at 18:42
show 5 more comments

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.