From 04d3a2fa8c9ba83b5a5d8aec8950dfa90dac1421 Mon Sep 17 00:00:00 2001 From: Will Woods Date: Oct 13 2020 19:47:30 +0000 Subject: Workaround for "NOT NULL constraint failed" crash (#1) This commit just makes parse-access-log.py filter out any match item that has missing (i.e. NULL) field values. This is quite rare, but it happened once in the Fedora mirror logs from September 16, resulting in this crash. Technically, these are still valid `countme` requests, so a future update should probably remove that constraint, and then re-parse the logs for September 16 (and any other logs with `countme` items that are missing `repo=XXX` or `arch=XXX`). But as of now that's 2 hits out of 14.5 million in the logs, so we're not missing much by ignoring malformed requests like these. --- diff --git a/parse-access-log.py b/parse-access-log.py index bb8de6b..30d3e57 100755 --- a/parse-access-log.py +++ b/parse-access-log.py @@ -102,6 +102,10 @@ def main(): # Make an iterator object for the matching log lines match_iter = iter(args.matcher(logf)) + # TEMP WORKAROUND: filter out match items with missing values + if args.matchmode == "countme": + match_iter = filter(lambda i: None not in i, match_iter) + # Duplicate data check (for sqlite output) if args.dupcheck: item = next(match_iter) # grab first matching item