From: Fabian Keil <fk@fabiankeil.de>
Date: Mon, 11 Jan 2021 13:23:52 +0000 (+0100)
Subject: privoxy-log-parser: Log truncated LOG_LEVEL_CLF messages more gracefully
X-Git-Tag: v_3_0_30~122
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/developer-manual/man-page/static/diff?a=commitdiff_plain;h=299b32a3e457af4ef165d87da561fff5885b5703;p=privoxy.git

privoxy-log-parser: Log truncated LOG_LEVEL_CLF messages more gracefully

... and note that the statistics will be inprecise.
---

diff --git a/tools/privoxy-log-parser.pl b/tools/privoxy-log-parser.pl
index 62503073..5e52de06 100755
--- a/tools/privoxy-log-parser.pl
+++ b/tools/privoxy-log-parser.pl
@@ -2090,7 +2090,12 @@ sub gather_loglevel_clf_stats($) {
     unless (defined $method) {
         # +0200] "Invalid request" 400 0
         return if ($content =~ m/^[+-]\d{4}\] "Invalid request"/);
-        print("Failed to parse: $content\n");
+        # +0100] "GET https://securepubads.g.doubleclick.net/gampad/ads?gd[...]... [too long, truncated]
+        if ($content =~ m/\[too long, truncated\]$/) {
+            print("Skipped LOG_LEVEL_CLF message that got truncated by Privoxy. Statistics will be inprecise.\n");
+        } else {
+            print("Failed to parse: $content\n");
+        }
         return;
     }
     $stats{'method'}{$method}++;