i'm trying to prevent apache from loging my own visits.. I've enabled SetEnvIf.so and added these lines to my vhost :
<VirtualHost *:80>
...
SetEnvIf Remote_Addr "192\.168\.1\.1" dontlog
SetEnvIf Remote_Addr "192\.168\.1\.5" dontlog
SetEnvIf Remote_Addr "192\.168\.1\.10" dontlog
</VirtualHost>
There must be something I'm doing wrong since it still logs 192.168.1.10 (.1 and .5 too) to my access.log.
Should SetEnvIf be set somewhere else instead ?
Cheers.
You should add env=!dontlog at the end of your CustomLog line.
Example (I also noticed the backslashes were not necessary):
<VirtualHost *:80>
...
SetEnvIf Remote_Addr "192.168.1.1" dontlog
SetEnvIf Remote_Addr "192.168.1.5" dontlog
SetEnvIf Remote_Addr "192.168.1.10" dontlog
...
CustomLog /var/log/apache2/mywebsite.access.log combined env=!dontlog
...
</VirtualHost>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With