X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=blobdiff_plain;f=tools%2Fprivoxy-log-parser.pl;h=0963993898e05f4447eeb68b996b8398d03d9265;hp=bc1ab04b0cfee1217a56d02531b833e6390a7711;hb=72c9421cb5d9b4155140db25d1bfc41e7ef90040;hpb=e42058e7c7ed0df990f2056ce40caee05159a76c diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl index bc1ab04b..09639938 100755 --- a/tools/privoxy-log-parser.pl +++ b/tools/privoxy-log-parser.pl @@ -2017,14 +2017,19 @@ sub gather_loglevel_clf_stats($) { our %cli_options; # +0200] "GET https://www.youtube.com/watch?v=JmcA9LIIXWw HTTP/1.1" 200 68004 - $content =~ m/^[+-]\d{4}\] "(\w+) (.+) (HTTP\/\d\.\d)" (\d+) (\d+)/; + # +0200] "VERSION-CONTROL http://p.p/ HTTP/1.1" 200 2787 + $content =~ m/^[+-]\d{4}\] "([^ ]+) (.+) (HTTP\/\d\.\d)" (\d+) (\d+)/; $method = $1; $resource = $2; $http_version = $3; $status_code = $4; $size = $5; + $stats{requests_clf}++; + unless (defined $method) { + # +0200] "Invalid request" 400 0 + return if ($content =~ m/^[+-]\d{4}\] "Invalid request"/); print("Failed to parse: $content\n"); return; } @@ -2035,12 +2040,11 @@ sub gather_loglevel_clf_stats($) { $stats{'http-version'}{$http_version}++; if ($cli_options{'host-statistics-threshold'} != 0) { - $resource =~ m@(?:http[s]://)([^/]+)/?@; + $resource =~ m@(?:https?://)?([^/]+)/?@; $stats{'hosts'}{$1}++; } $stats{'content-size-total'} += $size; $stats{'status-code'}{$status_code}++; - $stats{requests_clf}++; } sub gather_loglevel_request_stats($$) {