Added hostname in out data json

This commit is contained in:
Alexey 2018-10-12 21:38:06 +03:00
parent e5f894e606
commit 27b24e3336
2 changed files with 3 additions and 1 deletions

View file

@ -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<remote_host>[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

View file

@ -15,4 +15,4 @@ username = "username"
password = "password"
# Measurement name
measurement = some_name
measurement = geodata