privoxy-log-parser.pl: Include the size of the content Privoxy transferred
authorFabian Keil <fk@fabiankeil.de>
Fri, 29 May 2020 17:10:14 +0000 (19:10 +0200)
committerFabian Keil <fk@fabiankeil.de>
Mon, 1 Jun 2020 08:11:46 +0000 (10:11 +0200)
... excluding HTTP headers.

tools/privoxy-log-parser.pl

index f370e95..c24b89b 100755 (executable)
@@ -2009,6 +2009,7 @@ sub gather_loglevel_clf_stats ($) {
         $resource =~ m@(?:http[s]://)([^/]+)/?@;
         $stats{'hosts'}{$1}++;
     }
+    $stats{'content-size-total'} += $size;
 }
 
 sub gather_loglevel_request_stats ($$) {
@@ -2137,6 +2138,7 @@ sub init_stats () {
         'reused-connections' => 0,
         'server-keep-alive' => 0,
         'closed-client-connections' => 0,
+        'content-size-total' => 0,
         );
         $stats{'client-requests-on-connection'}{1} = 0;
 }
@@ -2201,7 +2203,9 @@ sub print_stats () {
         get_percentage($stats{requests}, $stats{'empty-responses-on-reused-connections'}) .
         ")\n";
     print "Client connections: " .  $stats{'closed-client-connections'} . "\n";
-
+    if ($stats{'content-size-total'}) {
+        print "Bytes transfered excluding headers: " .  $stats{'content-size-total'} . "\n";
+    }
     my $lines_printed = 0;
     print "Client requests per connection distribution:\n";
     foreach my $client_requests (sort {