Added SystemD service file, and country code in Tags
This commit is contained in:
parent
50700ce12e
commit
267a40e30e
3 changed files with 34 additions and 1 deletions
|
@ -43,6 +43,7 @@ def logparse(LOGPATH, INFLUXHOST, INFLUXPORT, INFLUXDBDB, INFLUXUSER, INFLUXUSER
|
||||||
HASH = Geohash.encode(INFO['latitude'], INFO['longitude']) # NOQA
|
HASH = Geohash.encode(INFO['latitude'], INFO['longitude']) # NOQA
|
||||||
COUNT['count'] = 1
|
COUNT['count'] = 1
|
||||||
GEOHASH['geohash'] = HASH
|
GEOHASH['geohash'] = HASH
|
||||||
|
GEOHASH['country_code'] = INFO['country_code']
|
||||||
IPS['tags'] = GEOHASH
|
IPS['tags'] = GEOHASH
|
||||||
IPS['fields'] = COUNT
|
IPS['fields'] = COUNT
|
||||||
IPS['measurement'] = MEASUREMENT
|
IPS['measurement'] = MEASUREMENT
|
||||||
|
@ -76,4 +77,4 @@ if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
os.system('clear')
|
os.system('clear')
|
||||||
sys.exit()
|
sys.exit(0)
|
||||||
|
|
16
geoparser.service
Normal file
16
geoparser.service
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
***GeoStat.service***
|
||||||
|
|
||||||
|
[Unit]
|
||||||
|
Description=GeoStat
|
||||||
|
After=network.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
ExecStart=/opt/geostat/venv/bin/python geoparser.py
|
||||||
|
User=root
|
||||||
|
WorkingDirectory=/opt/geostat
|
||||||
|
Restart=always
|
||||||
|
RestartSec=2
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
|
@ -1,2 +1,18 @@
|
||||||
[NGINX_LOG]
|
[NGINX_LOG]
|
||||||
|
#Path for the log file (Nginx/Apache)
|
||||||
logpath = /var/log/nginx/access.log
|
logpath = /var/log/nginx/access.log
|
||||||
|
|
||||||
|
[INFLUXDB]
|
||||||
|
# Database URL
|
||||||
|
host = 194.132.49.150
|
||||||
|
port = 8086
|
||||||
|
|
||||||
|
#Database name
|
||||||
|
database = telegraf
|
||||||
|
|
||||||
|
# HTTP Auth
|
||||||
|
username = "telegraf"
|
||||||
|
password = "secretpassword"
|
||||||
|
|
||||||
|
# Measurement name
|
||||||
|
measurement = geotags
|
||||||
|
|
Loading…
Reference in a new issue