From bdf44a6580eb92ca3dbd1c89b651372885471989 Mon Sep 17 00:00:00 2001 From: Fabian Keil Date: Sat, 30 May 2020 07:53:47 +0200 Subject: [PATCH] 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. --- tools/privoxy-log-parser.pl | 6 ++++++ 1 file changed, 6 insertions(+) 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; -- 2.39.2