From 27b24e33360c6da6021e1b542b1f9f88f933b51a Mon Sep 17 00:00:00 2001 From: Alexey Date: Fri, 12 Oct 2018 21:38:06 +0300 Subject: [PATCH] Added hostname in out data json --- geoparser.py | 2 ++ settings.ini.back | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/geoparser.py b/geoparser.py index c042a78..005fab1 100755 --- a/geoparser.py +++ b/geoparser.py @@ -18,6 +18,7 @@ def logparse(LOGPATH, INFLUXHOST, INFLUXPORT, INFLUXDBDB, INFLUXUSER, INFLUXUSER IPS = {} COUNT = {} GEOHASH = {} + HOSTNAME = os.uname()[1] CLIENT = InfluxDBClient(host=INFLUXHOST, port=INFLUXPORT, username=INFLUXUSER, password=INFLUXUSERPASS, database=INFLUXDBDB) # NOQA GETIP = r"^(?P[0-9]{,3}\.[0-9]{,3}\.[0-9]{,3}\.[0-9]{,3})" @@ -43,6 +44,7 @@ def logparse(LOGPATH, INFLUXHOST, INFLUXPORT, INFLUXDBDB, INFLUXUSER, INFLUXUSER HASH = Geohash.encode(INFO['latitude'], INFO['longitude']) # NOQA COUNT['count'] = 1 GEOHASH['geohash'] = HASH + GEOHASH['host'] = HOSTNAME GEOHASH['country_code'] = INFO['country_code'] IPS['tags'] = GEOHASH IPS['fields'] = COUNT diff --git a/settings.ini.back b/settings.ini.back index 299e0ff..2c4e443 100644 --- a/settings.ini.back +++ b/settings.ini.back @@ -15,4 +15,4 @@ username = "username" password = "password" # Measurement name -measurement = some_name +measurement = geodata