#868 SkipHosts is ignored


After upgrading to Perl 5.14.0 the IP-addresses in the SkipHosts are ignored or not completly removed from the stats (in both cases the collected history was removed before the run was done):

Version 5.14.0:
Parsed lines in file: 382804
Found 63148 dropped records,
Found 0 comments,
Found 0 blank records,
Found 31 corrupted records,
Found 22 old records,
Found 319603 new qualified records.

In the stats the IP-address is shown and that is not correct :-).

Version 5.12.3:
Parsed lines in file: 382804
Found 258615 dropped records,
Found 0 comments,
Found 0 blank records,
Found 31 corrupted records,
Found 10 old records,
Found 124148 new qualified records.

I'm no expert in Perl, so if you need more data or other information keep this in mind.


  • Luigi Lauro

    Luigi Lauro - 2011-06-15

    I confirm this.

    This problem is present in almost all configuration options.

    I've checked the perl sources and it seems that the function optimizeArray EMPTY the variables.

    For example, i modified the awstats.pl to print out the HostAliases array BEFORE the optimizeArray and after the optimizeArray, and while it was correct before, it was EMPTY after the call to the optimizeArray.

    You can check this (and temporarily fix it) by commenting the line where the optimizeArray is called on SkipHosts (or any other variabile passed to the optimizeArray), you will see it will start work again.

    I think this is a side-effect from some change from perl 5.14.

    Also the OS recognition doesn't work anymore (i think it's the very same problem).

  • Luigi Lauro

    Luigi Lauro - 2011-06-15

    Look out for this in cgi-bin/awstats.pl

        @SkipHosts = &OptimizeArray( \@SkipHosts, 1 );
        if ($Debug) {
                debug( "SkipHosts precompiled regex list is now @SkipHosts", 1 );

    Comment the call to optimize array to this:

        #@SkipHosts = &OptimizeArray( \@SkipHosts, 1 );
        if ($Debug) {
                debug( "SkipHosts precompiled regex list is now @SkipHosts", 1 );

    And it will work again (possibly less efficiently, since the optimize array is not called anymore).

    When can we have a fix for perl 5.14 bugs? :-)

  • Henk van de Kamer

    Thanks for confirming and finding the cause. As said I'm not an expert in Perl -- I only use standard software programmed by others :) -- so am curious if this is a standard Perl function or an Awstats one. If the first, we must probably open a bug in Perl itself?

  • Henk van de Kamer

    Awstats is completly unasable with Perl 5.14.0 because multiple hosts in one logfile is also not working. I would like to raise the severity to the highest level! Because now on a shared host people get toe see in there stats things from other websites. This is therfor now a security bug...

  • Alexander Wittig

    First a warning: I'm not a perl expert. I just had the same problem and debugged it till I found a solution that works.

    The problem seems to be that AWStats assumes a certain format for compiled regexps (qr/.../), which is really a Perl internal structure. And of course it changed with 5.14, breaking AWStats uncompiling of regexps.

    The problem appears in two subroutines: OptimizeArray and UnCompileRegex. The regex used by AWStats originally is /(\?[-\w]:(.))/, but in perl 5.14 the dash was replaced by a ^, so to make it work on <5.14 and 5.14, this regexp needs to be changed to /(\?[-^\w]:(.))/.

    Furthermore, the use of the same hard coded regexp in two places is not ideal, so I changed Optimize Array to call UnCompileRegex instead of uncompiling on its own. Thus, by changing each function as follows, everything seems to work again:

    OptimizeArray {
    my $array = shift;
    my @arrayunreg = map { UnCompileRegex($_) } @$array;
    my $notcasesensitive = shift;


    UnCompileRegex {
    shift =~ /(\?[-^\w]:(.))/;
    return $1;

    If needed I can run a diff of these two changes and (probably?) attach it here. it's really just a one line change you can make yourself manually ;-)

  • Andrew Denman

    Andrew Denman - 2011-12-09

    I can confirm this still occurs in Perl 5.14.2 and AWstats 7.0, affecting SkipHosts and completely killing OS detection. abgandar's fix (adding the ^ character) seems to correct the issue in my testing.

  • Comment has been marked as spam. 

    You can see all pending comments posted by this user  here

    Anonymous - 2012-01-27

    Thanks, downgrading (on Windows) to ActivePerl-5.12 fixed (temporarily at least) the issue for me.

    Last edit: Anonymous 2016-01-26
  • osvenskan

    osvenskan - 2012-05-04

    Thanks abgandar. This was driving me crazy, but your fix worked for me on AWStats 7.0 build 1.971.

    I have a patch file to offer but I don't see a way to attach it through the sourceforge interface. Hmmm....I'll post the patch here just in case I can't figure out a way to attach it.

    To apply this patch, just use this command:

    patch <awstats.patch

    Here's the patch file contents:

    --- awstats.pl.original 2010-10-16 13:24:03.000000000 -0400
    +++ awstats.pl 2012-05-04 10:11:48.000000000 -0400
    @@ -1353,9 +1353,7 @@
    sub OptimizeArray {
    my $array = shift;
    - my @arrayunreg = map {
    - if (/(\?[-\w]:(.))/) { $1 }
    - } @$array;
    + my @arrayunreg = map { UnCompileRegex($_) } @$array;
    my $notcasesensitive = shift;
    my $searchlist = 0;
    if ($Debug) {
    @@ -7809,7 +7807,7 @@
    # Return: standardregex
    sub UnCompileRegex {
    - shift =~ /(\?[-\w]:(.))/;
    + shift =~ /(\?[-^\w]:(.))/;
    return $1;

  • John Callahan

    John Callahan - 2012-10-16

    This change did not work for me. I am running Windows Server 2008 R2 32bit and tested Perl 5.14 and 5.16. I received the error when running awstats.pl:

    Sequence (?-^...) not recognized in regex: marked by <-- HERE in m/(?-^ <-- HERE klzzwxh:0010:(.))/ at C:\Apache2.2...\awstats.pl at line 7814.

    Dropping back to Perl 5.12 and not making any changes to awstats.pl worked for me.

    Last edit: John Callahan 2012-10-16
  • Laurent Destailleur (Eldy)

    7.1 beta 3 should fix this.

  • Laurent Destailleur (Eldy)

    • status: open --> closed
  • fbi1970

    fbi1970 - 2013-03-07

    I got same behaviour by using 7.1 + ActivePerl 5.14
    Please check it again.
    Now i reverted to ActivePerl 5.10.4 to make sure it's the same bug.

  • Laurent Destailleur (Eldy)

    Fix should be fixed with 7.1.1

  • Gormaz

    Gormaz - 2013-06-27


    I am still having the issue with Perl Strawberry and Awstats 7.1.1.
    I can see your commented fix in the awstats.pl but records are still all being dropped.
    I tried fixes proposed on this thread by other users but to no avail. I had no choice but to remove all the SkipHosts for now.

    As a note my SkipHosts is not a Regex but a long list of IP's separated by a space.
    Like this:


    Not sure if this could impact the way AWstats handle them.

    I was not having the issue using AWstats 7.00 and ActiveState Perl 5.10 (switched to Strawberry for large logs file handling as recommented).

  • Peter

    Peter - 2013-08-11

    Is it fixed? awstats not working with perl 5, version 14, subversion 2 in ubuntu server


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks