From: Fabian Keil Date: Sat, 30 May 2020 05:53:47 +0000 (+0200) Subject: privoxy-log-parser.pl: Generate statistics if the log only contains LOG_LEVEL_CLF... X-Git-Tag: v_3_0_29~342 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=bdf44a6580eb92ca3dbd1c89b651372885471989 privoxy-log-parser.pl: Generate statistics if the log only contains LOG_LEVEL_CLF messages ... so it can be used with vanilla webserver logs. Previously Privoxy-specific "Request:" messages were required. --- diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl index 0f95e969..5307a49c 100755 --- a/tools/privoxy-log-parser.pl +++ b/tools/privoxy-log-parser.pl @@ -2011,6 +2011,7 @@ sub gather_loglevel_clf_stats($) { } $stats{'content-size-total'} += $size; $stats{'status-code'}{$status_code}++; + $stats{requests_clf}++; } sub gather_loglevel_request_stats($$) { @@ -2126,6 +2127,7 @@ sub gather_loglevel_header_stats($$) { sub init_stats() { our %stats = ( requests => 0, + requests_clf => 0, crunches => 0, 'server-keep-alive' => 0, 'reused-connections' => 0, @@ -2167,6 +2169,10 @@ sub print_stats() { my $outgoing_requests = $stats{requests} - $stats{crunches}; my $client_requests_checksum = 0; + if ($stats{requests_clf} && $stats{requests} eq 0) { + $stats{requests} = $stats{requests_clf}; + } + if ($stats{requests} eq 0) { print "No requests yet.\n"; return;