diff --git a/geoparser.py b/geoparser.py index 96ac75a..6b66df9 100755 --- a/geoparser.py +++ b/geoparser.py @@ -43,6 +43,7 @@ def logparse(LOGPATH, INFLUXHOST, INFLUXPORT, INFLUXDBDB, INFLUXUSER, INFLUXUSER HASH = Geohash.encode(INFO['latitude'], INFO['longitude']) # NOQA COUNT['count'] = 1 GEOHASH['geohash'] = HASH + GEOHASH['country_code'] = INFO['country_code'] IPS['tags'] = GEOHASH IPS['fields'] = COUNT IPS['measurement'] = MEASUREMENT @@ -76,4 +77,4 @@ if __name__ == '__main__': main() except KeyboardInterrupt: os.system('clear') - sys.exit() + sys.exit(0) diff --git a/geoparser.service b/geoparser.service new file mode 100644 index 0000000..3ba9b04 --- /dev/null +++ b/geoparser.service @@ -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 diff --git a/settings.ini.back b/settings.ini.back index 62021c3..e08b350 100644 --- a/settings.ini.back +++ b/settings.ini.back @@ -1,2 +1,18 @@ [NGINX_LOG] +#Path for the log file (Nginx/Apache) 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