Gossamer Forum
Home : General : Perl Programming :

Preventing my IP from triggering a log script

Quote Reply
Preventing my IP from triggering a log script
I'm trying to track traffic on my web pages with a simple log that tells me what page the user came from and where he enters my web site. I just don't want to clutter up the log with my hits as I edit and test things. I've come to the poor solution of testing REMOTE_HOST =~ $me where $me is set to the non-dynamic portion of my host info.

Can anyone give me a better way to do this?
Quote Reply
Re: Preventing my IP from triggering a log script In reply to
It somewhat depends on why and what you are doing with your log. If you are trying to track access to sites and determine information on that end, you might be better served to see if your ISP allows you access to its server access logs. Many ISP's don't do this.

Another problem you might encounter is simply the fact that yout ISP assigns you more than one class C domain. In either case, I think the best way for you to handle this would be to use a sample code snippet as follows:

my ($my_ip, $host); # For those using strict
$my_ip = "192.168.0";
# This line might look tricky, but basically
# all we are doing is loading the environment
# variable into a $host variable and also
# into the PERL variable $_ which is used to
# match against the IP we are looking for.
$_ = $host = $ENV{'REMOTE_HOST'};

if (m/$my_ip/) {
# DO NOT LOG FOR MY_IP
} else {
# PERFORM LOGGING
}

Replace my comments in the IF areas to do whatever you want your logging program to do. My apologies if this code looks strange, you cannot unispace code on this forum.


------------------
Fred Hirsch
Web Consultant & Programmer
Quote Reply
Re: Preventing my IP from triggering a log script In reply to
Hia,

I am using AXS quite a while and i have no need for an other tool!

Go check: http://www.xav.com

If you can use SSI this is thé tool.

Cya