From e99b46b510a2d36de56ca2b84eaf1f9d035d703d Mon Sep 17 00:00:00 2001 From: GilbN <24592972+GilbN@users.noreply.github.com> Date: Mon, 10 Jan 2022 13:11:56 +0100 Subject: [PATCH] possible fix for #10 --- geoip2influx.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/geoip2influx.py b/geoip2influx.py index e3d7c7b..9cb02a3 100644 --- a/geoip2influx.py +++ b/geoip2influx.py @@ -211,12 +211,12 @@ def logparse( geohash_tags['host'] = hostname geohash_tags['country_code'] = info.country.iso_code geohash_tags['country_name'] = info.country.name - geohash_tags['state'] = info.subdivisions.most_specific.name - geohash_tags['state_code'] = info.subdivisions.most_specific.iso_code - geohash_tags['city'] = info.city.name - geohash_tags['postal_code'] = info.postal.code - geohash_tags['latitude'] = info.location.latitude - geohash_tags['longitude'] = info.location.longitude + geohash_tags['state'] = info.subdivisions.most_specific.name if info.subdivisions.most_specific.name else "-" + geohash_tags['state_code'] = info.subdivisions.most_specific.iso_code if info.subdivisions.most_specific.iso_code else "-" + geohash_tags['city'] = info.city.name if info.city.name else "-" + geohash_tags['postal_code'] = info.postal.code if info.postal.code else "-" + geohash_tags['latitude'] = info.location.latitude if info.location.latitude else "-" + geohash_tags['longitude'] = info.location.longitude if info.location.longitude else "-" ips['tags'] = geohash_tags ips['fields'] = geohash_fields ips['measurement'] = geo_measurement