added debug logging on IP type

This commit is contained in:
gilbn 2021-11-04 22:54:42 +01:00
parent b3dcebf20a
commit 7edef5a6fb

View file

@ -200,7 +200,8 @@ def logparse(
f'Line: {line}' f'Line: {line}'
) )
continue 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) info = gi.city(ip)
if info is not None: if info is not None:
geohash = encode(info.location.latitude, info.location.longitude) 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' logging.error('Error writing data to InfluxDB! Check your database!\n'
f'Error: {e}' f'Error: {e}'
) )
else:
logging.debug(f"Incorrect IP type: {ip_type}")
if send_logs: if send_logs:
data = search(log, line) 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) info = gi.city(ip)
if info is not None: if info is not None:
datadict = data.groupdict() datadict = data.groupdict()