From: eldy <> Date: Fri, 1 Nov 2002 03:08:39 +0000 (+0000) Subject: Fixed a bug when using %query or cs-query-string tag in LogFormat. X-Git-Tag: AWSTATS_5_2_BETA~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eb4903cd3ec0eaf8dbf3bd613a915ac9679948e;p=thirdparty%2FAWStats.git Fixed a bug when using %query or cs-query-string tag in LogFormat. Ignore bad http code for Microsoft Index Servers. --- diff --git a/docs/awstats_changelog.txt b/docs/awstats_changelog.txt index 37e8c8c9..c894ac06 100644 --- a/docs/awstats_changelog.txt +++ b/docs/awstats_changelog.txt @@ -8,7 +8,10 @@ AWStats Changelog - Removed "Bytes" text when values is 0. - Reduced main page size. - New parameter: Added OnlyHosts parameter. - +- Fixed a bug when using IIS and %query or cs-query-string tag in LogFormat + and URLWithQuery=1. +- Records with bad http code for Microsoft Index Servers (on 1 digit instead + of 3) are no more reported as corrupted records. 5.1 diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index 82fb4a49..587108f0 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -4559,6 +4559,7 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat $LogFormatString =~ s/%{mod_gzip_output_size}n/%gzipout/g; $LogFormatString =~ s/%{mod_gzip_compression_ratio}n/%gzipratio/g; # Replacement for a IIS and ISA format string + $LogFormatString =~ s/cs-uri-query/%query/g; # Must be before cs-uri $LogFormatString =~ s/date\stime/%time2/g; $LogFormatString =~ s/c-ip/%host/g; $LogFormatString =~ s/cs-username/%logname/g; @@ -4569,7 +4570,6 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat $LogFormatString =~ s/cs-version/%other/g; # Protocol $LogFormatString =~ s/cs\(User-Agent\)/%ua/g; $LogFormatString =~ s/c-agent/%ua/g; $LogFormatString =~ s/cs\(Referer\)/%referer/g; $LogFormatString =~ s/cs-referred/%referer/g; - $LogFormatString =~ s/cs-uri-query/%host/g; $LogFormatString =~ s/sc-authenticated/%other/g; $LogFormatString =~ s/s-svcname/%other/g; $LogFormatString =~ s/s-computername/%other/g; @@ -4910,12 +4910,12 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat # Check return status code #------------------------- - if ($protocol == 1 || $protocol == 4) { # HTTP record or Stream record + if ($protocol == 1 || $protocol == 4) { # HTTP record or Stream record if ($ValidHTTPCodes{$field[$pos_code]}) { # Code is valid if ($field[$pos_code] == 304) { $field[$pos_size]=0; } } else { # Code is not valid - if ($field[$pos_code] =~ /^\d\d\d$/) { # Keep error code and next + if ($field[$pos_code] =~ /^\d\d\d$/) { # Keep error code and next $_errors_h{$field[$pos_code]}++; $_errors_k{$field[$pos_code]}+=int($field[$pos_size]); foreach my $code (keys %TrapInfosForHTTPErrorCodes) { @@ -4923,14 +4923,17 @@ if ($UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft') { # Updat } next; } - else { # Bad format record (should not happen but when using MSIndex server), next - $NbOfLinesCorrupted++; $NbOfNewLines--; - if ($ShowCorrupted) { print "Corrupted record (HTTP code not on 3 digits): $_\n"; } - next; + else { # Bad format record (should not happen but when using MSIndex server), next + # Second test avoid error when using MS IndexServer that returns non standard HTTP code on 1 char + if ($field[$pos_code] !~ /^\d$/) { + $NbOfLinesCorrupted++; $NbOfNewLines--; + if ($ShowCorrupted) { print "Corrupted record (HTTP code not on 3 digits): $_\n"; } + next; + } } } } - elsif ($protocol == 3) { # SMTP record + elsif ($protocol == 3) { # SMTP record if ($field[$pos_code] != 1) { # Code is not valid $field[$pos_size]=0; $_errors_h{$field[$pos_code]}++;