X-Git-Url: http://www.privoxy.org/gitweb/?a=blobdiff_plain;f=tools%2Fprivoxy-log-parser.pl;h=175cd28f8e055c1e5206a62bc37fcf9d09228979;hb=cff34707a315c5670ef0d554f962565bb7ea05bd;hp=12d88947ab56c4779d8f8b2d916ab4f1d22645c8;hpb=acaa3563ddbdc2a1a11c36e1501f9ad3dfbb8de2;p=privoxy.git diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl index 12d88947..175cd28f 100755 --- a/tools/privoxy-log-parser.pl +++ b/tools/privoxy-log-parser.pl @@ -8,7 +8,7 @@ # # http://www.fabiankeil.de/sourcecode/privoxy-log-parser/ # -# $Id: privoxy-log-parser.pl,v 1.156 2013/01/16 16:29:26 fabiankeil Exp $ +# $Id: privoxy-log-parser.pl,v 1.161 2013/08/29 11:12:13 fabiankeil Exp $ # # TODO: # - LOG_LEVEL_CGI, LOG_LEVEL_ERROR, LOG_LEVEL_WRITE content highlighting @@ -25,7 +25,7 @@ # hash key as input. # - Add --compress and --decompress options. # -# Copyright (c) 2007-2012 Fabian Keil +# Copyright (c) 2007-2013 Fabian Keil # # Permission to use, copy, modify, and distribute this software for any # purpose with or without fee is hereby granted, provided that the above @@ -45,7 +45,7 @@ use warnings; use Getopt::Long; use constant { - PRIVOXY_LOG_PARSER_VERSION => '0.7', + PRIVOXY_LOG_PARSER_VERSION => '0.8', # Feel free to mess with these ... DEFAULT_BACKGROUND => 'black', # Choose registered colour (like 'black') DEFAULT_TEXT_COLOUR => 'white', # Choose registered colour (like 'black') @@ -646,7 +646,7 @@ sub highlight_request_line ($) { $rl = h('invalid-request') . $rl . h('Standard'); - } elsif ($rl =~ m/^([-\w]+) (.*) (HTTP\/\d\.\d)/) { + } elsif ($rl =~ m/^([-\w]+) (.*) (HTTP\/\d+\.\d+)/) { # XXX: might not match in case of HTTP method fuzzing. # XXX: save these: ($method, $path, $http_version) = ($1, $2, $3); @@ -2188,7 +2188,8 @@ sub print_stats () { unless ($cli_options{'show-complete-request-distribution'}) { printf "Enable --show-complete-request-distribution to get less common numbers as well.\n"; } - printf "Unaccounted requests: ~%d\n", $stats{requests} - $client_requests_checksum; + # Due to log rotation we may not have a complete picture for all the requests + printf "Improperly accounted requests: ~%d\n", abs($stats{requests} - $client_requests_checksum); if ($stats{method} eq 0) { print "No response lines parsed yet yet.\n"; @@ -2425,7 +2426,7 @@ sub stats_loop () { (undef, $time_stamp, $thread, $log_level, $content) = split(/ /, $_, 5); # Skip LOG_LEVEL_CLF - next if ($time_stamp eq "-" or not defined($log_level)); + next if (not defined($log_level) or $time_stamp eq "-"); if (defined($log_level_handlers{$log_level})) { @@ -2469,7 +2470,6 @@ sub VersionMessage { my $version_message; $version_message .= 'Privoxy-Log-Parser ' . PRIVOXY_LOG_PARSER_VERSION . "\n"; - $version_message .= 'Copyright (C) 2007-2010 Fabian Keil ' . "\n"; $version_message .= 'http://www.fabiankeil.de/sourcecode/privoxy-log-parser/' . "\n"; print $version_message;