Forum Moderators: DixonJones

Message Too Old, No Replies

Remove certain IPs from Apache log

         

moltar

5:00 pm on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to filter out certain IPs from Apache log file. I don't want them to be logged at all as a matter of fact.

For example myself, then I also have a template engine that grabs pages off the server. Every page request it grabs a template. Also there are some quite annoying bots like Internet Seer that keep coming 100 times a day...

I don't have access to httpd.config, but maybe it's possible to do by .htaccess?

TIA

bakedjake

8:00 pm on Jul 30, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



What is it that you're trying to do?

I ask this because if you're trying to exclude the IPs from your web analysis software reports, you should do it in the web analysis software. Every package that I know of, from free to $15,000+ supports this feature.

If that is your goal, do it there, not in the logs.

moltar

8:20 pm on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



No, I actually want to exclude them from the logs, not from stats software.

bakedjake

8:26 pm on Jul 30, 2003 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



With Apache 1.3, you can exclude things from the log. For example, suppose your template is called /template.html. You'd do it like this:

# Don't log /template.html
SetEnvIf Request_URI "^/template\.html$" dontlog
# Log everything else
CustomLog logs/access_log combined env=!dontlog

Check out [httpd.apache.org...] for more information. Unfortunately, you can only use it within the main server config or virtual host directive, not in .htaccess. Sorry.

bcolflesh

8:55 pm on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you going to keep a log of the excluded IPs? Otherwise, this is a big mistake.

moltar

9:18 pm on Jul 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I want to exclude some log lines that contain certain IPs. The most common ones at this point, since the site is very new :)

I am a frequent visitor and I have a Perl script that requests pages from the same server, so that SSIs can be parsed correctly for further template use. So every time user requests a page, Perl grabs 1 or 2 pages from the server, so my logs double the size with totaly useless information.