Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#756 Extra section zero values not being counted

6.9
open
nobody
5
2012-10-11
2009-07-27
Dave Adams
No

We use AWStats to report on response times in milliseconds, using the ExtraSection feature. We have recently noticed that some calls to our web service are responded to nearly instantly and record 0 milliseconds in our access logs. These 0 values are not being counted or reported by awstats.

In anticipation of the obvious requests for clarification, here is the definition of the extraSection I have that is not giving me zero values:

ExtraSectionName1="API Response Time"
ExtraSectionCodeFilter1="200 304"
ExtraSectionCondition1="URL,instr\/tags"
ExtraSectionFirstColumnTitle1="Response Time"
ExtraSectionFirstColumnValues1="extra1,([0-9]*)$"
ExtraSectionFirstColumnFormat1="%s"
ExtraSectionStatTypes1=P
ExtraSectionAddAverageRow1=0
ExtraSectionAddSumRow1=0
MaxNbOfExtra1=20000
MinHitExtra1=1

Discussion

  • I fixed it as follows in version 6.95:

    1/ change the value of MinHitExtra1 to 0
    2/ in line 8182 outcomment: delete $hashforselect->{0};
    3/ in line 12848 replace
    if ( !$rowkeyval )
    by
    if ( !($rowkeyval or $rowkeyval == 0) )

     
  • Here's a patch file:

    --- C:/awstats.pl Sat Oct 10 14:36:38 2009
    +++ C:/Program Files/AWStats/wwwroot/cgi-bin/awstats.pl Mon Apr 26 16:43:15 2010
    @@ -8179,7 +8179,7 @@
    3
    );
    }
    - delete $hashforselect->{0};
    + #delete $hashforselect->{0};
    delete $hashforselect->{ ''
    }; # Those is to protect from infinite loop when hash array has an incorrect null key
    my $count = 0;
    @@ -12845,7 +12845,7 @@
    }
    }
    if ( !$rowkeyok ) { next; } # End for this section
    - if ( !$rowkeyval ) { $rowkeyval = 'Failed to extract key'; }
    + if ( !($rowkeyval or $rowkeyval == 0) ) { $rowkeyval = 'Failed to extract key'; }
    if ($Debug) { debug( " Key val found: $rowkeyval", 5 ); }

            # Apply function on $rowkeyval
    
     
  • Stefan Mayr
    Stefan Mayr
    2011-08-02

    Bug is still present in version 7.0 (build 1.971)

    last comment with updated line numers:
    1/ change the value of MinHitExtra1 to 0
    2/ in line 8287 outcomment: delete $hashforselect->{0};
    3/ in line 19749 replace
    if ( !$rowkeyval )
    by
    if ( !($rowkeyval or $rowkeyval == 0) )

     
  • Stefan Mayr
    Stefan Mayr
    2011-08-02

    as patch file

    --- awstats.pl.orig 2011-08-02 18:01:15.000000000 +0200
    +++ awstats.pl 2011-08-02 18:02:50.000000000 +0200
    @@ -8284,7 +8284,7 @@
    3
    );
    }
    - delete $hashforselect->{0};
    + # delete $hashforselect->{0};
    delete $hashforselect->{ ''
    }; # Those is to protect from infinite loop when hash array has an incorrect null key
    my $count = 0;
    @@ -19746,7 +19746,7 @@
    }
    }
    if ( !$rowkeyok ) { next; } # End for this section
    - if ( !$rowkeyval ) { $rowkeyval = 'Failed to extract key'; }
    + if ( !($rowkeyval or $rowkeyval == 0) ) { $rowkeyval = 'Failed to extract key'; }
    if ($Debug) { debug( " Key val found: $rowkeyval", 5 ); }

                        # Apply function on $rowkeyval