tags:

views:

1225

answers:

3

I'm updating some old AWStats config files to filter out some specific IP ranges. Here's the pertinent section of the config file:

# Do not include access from clients that match following criteria.
# If your log file contains IP addresses in host field, you must enter here
# matching IP addresses criteria.
# If DNS lookup is already done in your log file, you must enter here hostname
# criteria, else enter ip address criteria.
# The opposite parameter of "SkipHosts" is "OnlyHosts".
# Note: Use space between each value. This parameter is not case sensitive.
# Note: You can use regular expression values writing value with REGEX[value].
# Change : Effective for new updates only
# Example: "127.0.0.1 REGEX[^192\.168\.] REGEX[^10\.]"
# Example: "localhost REGEX[^.*\.localdomain$]"
# Default: ""
#
SkipHosts=""

I want to, for example, filter out X.Y.Z.[97-110]

I tried this format (Note: Not these IP values, using private range as example):

REGEX[^192\.168\.1\.[97-110]]

But it causes the following error:

CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

I hate how everything uses a different RegEx syntax. Does anyone have any idea how this one works, and how I can specify a range here?

A: 

Does AWStats run if you leave SkipHosts empty? Otherwise, try the commandline utility to check for errors. For example, using Windows:

c:\perlpath\perl.exe awstats.pl config=yourconfigfile -update -logfile=yourlogfile

That should give more details.

Casper
Yes, empty is the default; and it runs fine with an empty value.
Adam Tuttle
Ok. Do you get more details using the command utility?
Casper
+2  A: 

Assuming that character classes are supported within REGEX[ ]:

SkipHosts = "REGEX[^192\.168\.1\.(9[7-9]|10[0-9]|110)$]"
MizardX
Works perfectly, thanks!
Adam Tuttle
+2  A: 

The regex you used specifies 9 or 7 to 1 or 1 or 0 which messes up.

You can use

SkipHosts="REGEX[^192\.168\.1\.(97|98|99|100|101|102|103|104|105|106|107|108|109|110)]"

if you're so inclined

Peter Turner
Yup previous answer is better, but I tested this one with my AWstats package.
Peter Turner