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