privoxy-log-parser: Log truncated LOG_LEVEL_CLF messages more gracefully
authorFabian Keil <fk@fabiankeil.de>
Mon, 11 Jan 2021 13:23:52 +0000 (14:23 +0100)
committerFabian Keil <fk@fabiankeil.de>
Wed, 13 Jan 2021 08:57:54 +0000 (09:57 +0100)
... and note that the statistics will be inprecise.

tools/privoxy-log-parser.pl

index 6250307..5e52de0 100755 (executable)
@@ -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}++;