AWStats has the option SkipHosts
for the configuration file, but my IP changes all the time.
So what I did was this:
... if ($param =~ /^SkipHosts/) { @SkipHosts=(); #foreach my $elem (split(/\s+/,$value)) { # if ($elem =~ /^REGEX\[(.*)\]$/i) { $elem=$1; } # else { $elem='^'.quotemeta($elem).'$'; } # if ($elem) { push @SkipHosts, qr/$elem/i; } #} #### my $ips="/home/whoever/ips.txt"; open(DAT, $ips) || die("can't open ip list"); my @lines=<DAT>; close(DAT); foreach my $line (@lines) { chop($line); my $esc='^'.quotemeta($line).'$'; push @SkipHosts, qr/$esc/i; } #### next; } ... |
(You may want to keep the old code which I commented out and concatenate it with your values for @SkipHosts
.)
How that can be done depends on the situation. In my case I can safely assume that I have logged in to the web server over ssh with most IPs that I would use, so I added this to the .bash_profile
:
echo $SSH_CLIENT | egrep -i -o '([[:digit:]]+\.){3}[[:digit:]]+' >> ips.txt |
Hope it helps someone.
]]>