From: Sarah Hoffmann Date: Tue, 16 Dec 2014 12:20:59 +0000 (+0100) Subject: ignore badly formatted log lines X-Git-Tag: deploy~495 X-Git-Url: https://git.openstreetmap.org./nominatim.git/commitdiff_plain/9c1abc4b75b941f434d6a120bd1c8fc4f1031c30?ds=inline ignore badly formatted log lines --- diff --git a/munin/nominatim_query_speed_querylog b/munin/nominatim_query_speed_querylog index d663faf1..4bbeac68 100755 --- a/munin/nominatim_query_speed_querylog +++ b/munin/nominatim_query_speed_querylog @@ -128,9 +128,8 @@ class LogFile: def loglines(self): for l in self.fd: e = ENTRY_REGEX.match(l) - if e is None: - raise ValueError("Invalid log line:", l) - yield e.groupdict() + if e is not None: + yield e.groupdict() if __name__ == '__main__': diff --git a/munin/nominatim_requests_querylog b/munin/nominatim_requests_querylog index 8538a95c..aa41a4de 100755 --- a/munin/nominatim_requests_querylog +++ b/munin/nominatim_requests_querylog @@ -121,9 +121,8 @@ class LogFile: def loglines(self): for l in self.fd: e = ENTRY_REGEX.match(l) - if e is None: - raise ValueError("Invalid log line:", l) - yield e.groupdict() + if e is not None: + yield e.groupdict() if __name__ == '__main__': diff --git a/utils/cron_ipanalyse.py b/utils/cron_ipanalyse.py index 262090a4..18582667 100755 --- a/utils/cron_ipanalyse.py +++ b/utils/cron_ipanalyse.py @@ -186,7 +186,10 @@ class LogFile: def loglines(self): for l in self.fd: - yield LogEntry(l) + try: + yield LogEntry(l) + except ValueError: + pass # ignore invalid lines class BlockList: