AWStats
From SpenchWiki
Revision as of 09:58, 31 August 2011 by Balint (talk | contribs) (Created page with 'Patch to AWStatus to enable precise (and more flexible) log line matching: For example, for Squid reverse proxy: LogFormat="%time4b %other %host %other/%code %bytesd %method h...')
Patch to AWStatus to enable precise (and more flexible) log line matching:
For example, for Squid reverse proxy:
LogFormat="%time4b %other %host %other/%code %bytesd %method http://%virtualname%url %other %other/%other %other"
8723a8724,8730
>
> # IIS other
> $LogFormatString =~ s/s-ip/%other/g;
> $LogFormatString =~ s/s-port/%other/g;
> $LogFormatString =~ s/cs\(Cookie\)/%other/g;
> $LogFormatString =~ s/sc-substatus/%other/g;
> $LogFormatString =~ s/sc-win32-status/%other/g;
8736,8737c8743,8752
< foreach my $f ( split( /\s+/, $LogFormatString ) ) {
<
---
> # foreach my $f ( split( /\s+/, $LogFormatString ) ) {
> foreach my $fx ( split( /%/, $LogFormatString ) ) { # FIXME: %% -> empty string in between them, prepend to next iteration (ignore first loop though!)
>
> my $f = $fx;
> $f =~ s/^([a-z\d_]+).*/%$1/;
> my $fz = substr($fx, (length($f)-1));
> $fz =~ s/(\/|\\)/\\$1/g;
> $fz =~ s/\s+/$LogSeparator/g;
> if ($Debug) { debug(" fx=\"$fx\", f=\"$f\", fz=\"$fz\""); }
8739c8754
< if ($PerlParsingFormat) { $PerlParsingFormat .= "$LogSeparator"; }
---
> #if ($PerlParsingFormat) { $PerlParsingFormat .= "$LogSeparator"; }
8792a8808,8813
> elsif ( $f =~ /%time4b$/ ) { # ddddddddddddd.ddd (only take first lot)
> $pos_date = $i;
> $i++;
> push @fieldlib, 'date';
> $PerlParsingFormat .= "(\\d+)[\\.\\d]*";
> }
8829c8850,8851
< $PerlParsingFormat .= "([^$LogSeparatorWithoutStar]+)";
---
> #$PerlParsingFormat .= "([^$LogSeparatorWithoutStar]+)";
> $PerlParsingFormat .= "([\\w\\.-]+)";
9000c9022
< else {
---
> elsif ( $f !~ /^$/ ) {
9002a9025,9026
>
> $PerlParsingFormat .= $fz;
10865a10890
> || $field[$pos_method] eq 'CONNECT' # Squid