From: eldy <> Date: Sun, 10 Feb 2013 15:39:22 +0000 (+0000) Subject: New: Add patch #197 X-Git-Tag: AWSTATS_7_2~18 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f2e3058c7f47475b23809fb14855e49505ed596a;p=thirdparty%2FAWStats.git New: Add patch #197 --- diff --git a/docs/awstats_changelog.txt b/docs/awstats_changelog.txt index b854eefc..9df91753 100644 --- a/docs/awstats_changelog.txt +++ b/docs/awstats_changelog.txt @@ -7,7 +7,7 @@ $Revision$ - $Author$ - $Date$ New features: - Add windows 8 detection - +- Add support of %time5 for iso date times. ***** 7.1 ***** diff --git a/wwwroot/cgi-bin/awstats.model.conf b/wwwroot/cgi-bin/awstats.model.conf index c9487e4f..d900e1d7 100644 --- a/wwwroot/cgi-bin/awstats.model.conf +++ b/wwwroot/cgi-bin/awstats.model.conf @@ -83,6 +83,7 @@ LogType=W # %time2 Date and time with format: yyyy-mm-dd hh:mm:ss # %time3 Date and time with format: Mon dd hh:mm:ss or Mon dd hh:mm:ss yyyy # %time4 Date and time with unix timestamp format: dddddddddd +# %time5 Date and time with format iso: yyyy-mm-ddThh:mm:ss # %methodurl Method and URL with format: "GET /index.html HTTP/x.x" # %methodurlnoprot Method and URL with format: "GET /index.html" # %method Method with format: GET diff --git a/wwwroot/cgi-bin/awstats.pl b/wwwroot/cgi-bin/awstats.pl index 872c2497..18a9a865 100644 --- a/wwwroot/cgi-bin/awstats.pl +++ b/wwwroot/cgi-bin/awstats.pl @@ -9075,6 +9075,16 @@ sub DefinePerlParsingFormat { push @fieldlib, 'date'; $PerlParsingFormat .= "(\\d+)"; } + elsif ( $f =~ /%time5$/ ) { # yyyy-mm-ddThh:mm:ss+00:00 (iso format) + $pos_date = $i; + $i++; + push @fieldlib, 'date'; + $pos_tz = $i; + $i++; + push @fieldlib, 'tz'; + $PerlParsingFormat .= +"([^$LogSeparatorWithoutStar]+)\\+([^$LogSeparatorWithoutStar]+)"; + } # Special for methodurl and methodurlnoprot elsif ( $f =~ /%methodurl$/ ) { @@ -18189,12 +18199,13 @@ if ( $UpdateStats && $FrameName ne 'index' && $FrameName ne 'mainleft' ) } $field[$pos_date] =~ - tr/,-\/ \t/:::::/s; # " \t" is used instead of "\s" not known with tr + tr/,-\/ \tT/::::::/s; # " \t" is used instead of "\s" not known with tr my @dateparts = - split( /:/, $field[$pos_date] ) - ; # tr and split faster than @dateparts=split(/[\/\-:\s]/,$field[$pos_date]) - # Detected date format: dddddddddd, YYYY-MM-DD HH:MM:SS (IIS), MM/DD/YY\tHH:MM:SS, - # DD/Month/YYYY:HH:MM:SS (Apache), DD/MM/YYYY HH:MM:SS, Mon DD HH:MM:SS + split( /:/, $field[$pos_date] ); # tr and split faster than @dateparts=split(/[\/\-:\s]/,$field[$pos_date]) + # Detected date format: + # dddddddddd, YYYY-MM-DD HH:MM:SS (IIS), MM/DD/YY\tHH:MM:SS, + # DD/Month/YYYY:HH:MM:SS (Apache), DD/MM/YYYY HH:MM:SS, Mon DD HH:MM:SS, + # YYYY-MM-DDTHH:MM:SS (iso) if ( !$dateparts[1] ) { # Unix timestamp ( $dateparts[5], $dateparts[4], $dateparts[3],