I'm updating some old AWStats config files to filter out some specific IP ranges. Here's the pertinent section of the config file:
我正在更新一些旧的AWStats配置文件来过滤掉一些特定的IP范围。这是配置文件的相关部分:
# 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]
我想,例如,过滤掉X.Y.Z. [97-110]
I tried this format (Note: Not these IP values, using private range as example):
我尝试了这种格式(注意:不是这些IP值,使用私有范围作为示例):
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.CGI错误指定的CGI应用程序因未返回完整的HTTP标头集而行为不端。
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?
我讨厌一切都使用不同的RegEx语法。有没有人知道这个是如何工作的,以及我如何在这里指定一个范围?
3 个解决方案
#1
2
Assuming that character classes are supported within REGEX[ ]:
假设REGEX []支持字符类:
SkipHosts = "REGEX[^192\.168\.1\.(9[7-9]|10[0-9]|110)$]"
#2
2
The regex you used specifies 9 or 7 to 1 or 1 or 0 which messes up.
你使用的正则表达式指定9或7到1或1或0搞砸了。
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
如果你这么倾向
#3
0
Does AWStats run if you leave SkipHosts empty? Otherwise, try the commandline utility to check for errors. For example, using Windows:
如果你把SkipHosts留空,AWStats会运行吗?否则,请尝试使用命令行实用程序来检查错误。例如,使用Windows:
c:\perlpath\perl.exe awstats.pl config=yourconfigfile -update -logfile=yourlogfile
That should give more details.
这应该提供更多细节。
#1
2
Assuming that character classes are supported within REGEX[ ]:
假设REGEX []支持字符类:
SkipHosts = "REGEX[^192\.168\.1\.(9[7-9]|10[0-9]|110)$]"
#2
2
The regex you used specifies 9 or 7 to 1 or 1 or 0 which messes up.
你使用的正则表达式指定9或7到1或1或0搞砸了。
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
如果你这么倾向
#3
0
Does AWStats run if you leave SkipHosts empty? Otherwise, try the commandline utility to check for errors. For example, using Windows:
如果你把SkipHosts留空,AWStats会运行吗?否则,请尝试使用命令行实用程序来检查错误。例如,使用Windows:
c:\perlpath\perl.exe awstats.pl config=yourconfigfile -update -logfile=yourlogfile
That should give more details.
这应该提供更多细节。