From 7edef5a6fb402bb37f279763c9458c7c1c161de4 Mon Sep 17 00:00:00 2001 From: gilbn Date: Thu, 4 Nov 2021 22:54:42 +0100 Subject: [PATCH] added debug logging on IP type --- geoip2influx.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/geoip2influx.py b/geoip2influx.py index 8518327..e3d7c7b 100644 --- a/geoip2influx.py +++ b/geoip2influx.py @@ -200,7 +200,8 @@ def logparse( f'Line: {line}' ) continue - if ipadd(ip).iptype() in monitored_ip_types and ip: + ip_type = ipadd(ip).iptype() + if ip_type in monitored_ip_types and ip: info = gi.city(ip) if info is not None: geohash = encode(info.location.latitude, info.location.longitude) @@ -227,10 +228,11 @@ def logparse( logging.error('Error writing data to InfluxDB! Check your database!\n' f'Error: {e}' ) - + else: + logging.debug(f"Incorrect IP type: {ip_type}") if send_logs: data = search(log, line) - if ipadd(ip).iptype() in monitored_ip_types and ip: + if ip_type in monitored_ip_types and ip: info = gi.city(ip) if info is not None: datadict = data.groupdict()