These forums are locked and archived, but all topics have been migrated to the new forum. You can search for this topic on the new forum: Search for Stop Apache to log certain strings to access_log - possible? [SOLVED] on the new forum.
Is it possible to stop Apache logging certain strings in to apache_log file? (i.e. certain IP address?)
(We've got some live online support system and it keeps sending traffic backwards and forwards from our own LAN and logs are full of those POST/GET requests), log files are massive in size.
I've heard it could be done via "SetEnvIf" directive in Apache somehow?
Can someone please point me in some direction, give an example how to do it? Is it Webmin or Virtualmin setting? This particular server is on Virtualmin/Webmin GPL version.
Appreciate your time and support.
Howdy,
Well, if a change like that would work, it would be something that you'd change in Apache itself, rather than a Webmin/Virtualmin setting.
However, I'm not sure how to accomplish it :-)
Reviewing the SetEnvIf documentation here:
http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html
I do see a way to have it test for a particular IP address, but I don't see a way to have it change VirtualHost settings, including filtering logs, based on that criteria.
That said, now that I do a little Googling, I do see some examples that show how it may work.
If you were to edit your Apache config, and add something like this to the VirtualHost block for the domain in question, it might do the trick :-)
SetEnvIf Remote_Addr "192.168.0.154" dontlog
I've never tried that before, so you may need to experiment a bit, but perhaps that'll get you started.
-Eric
Cheers, andreychek
Here is working solution:
Go to:
Webmin - Servers - Apache Server - Edit config files - go to a website u need and find this
#original line CustomLog /home/yourwebsite/logs/access_log combined
# replace it with:
CustomLog /home/yourwebsite/logs/access_log combined env=!dontlog
# and add this line
SetEnvIf Request_URI "^/livehelp/server.php$" dontlog
I've used dontlog by URL (Request_URI)
But you can also use variables such as IP, user_agent, etc, here is full list:
http://www.howtoforge.com/setenvif_apache2
I hope it helps someone in the future
The env=!dontlog works great! Thankls for that.
One issue though.... When I transfer a server to another virtualmin GPL server that setenv thingy is not send over. So the new server is bloating the log files again. Would be nice if it did get copied over when I do a transfer :)
Thanks, great software!
none
All what we want for the hack snap all is ready for snapchat.