diff --git a/GeoLiteCity.dat b/GeoLiteCity.dat deleted file mode 100644 index 1adb8c3..0000000 Binary files a/GeoLiteCity.dat and /dev/null differ diff --git a/README.md b/README.md index 4fa716e..dd88144 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ GeoStat is a Python script for parsing Nginx and Apache logs files and getting G - Parsing incoming ip's from web server log and convert them in to GEO metrics for the InfluxDB. - Used standard python lib's for the maximus compatibility. - Having an external **settings.ini** for comfortable changing parameters. - -Json format that script send to InfluxDB looks like: + +Json format that script send to InfluxDB looks like: ``` [ { @@ -25,7 +25,7 @@ Json format that script send to InfluxDB looks like: } ] ``` -As you can see there is two tags field, so you can build dashboards using geohash or just country code, count for any metric equal 1. This script don't parse log file from begining but parse it line by line after runing. So you can build dashboards using "count" of geohashes or country codes after some time will pass. +As you can see there is two tags field, so you can build dashboards using geohash or just country code, count for any metric equal 1. This script don't parse log file from begining but parse it line by line after runing. So you can build dashboards using "count" of geohashes or country codes after some time will pass. ### Tech @@ -55,7 +55,13 @@ $ cp geostat.service.template geostat.service $ vi geostat.service $ cp geostat.service /lib/systemd/system/ ``` -3) Then enable and start service +4) Download latest GeoLiteCity.dat from MaxMind +```sh +$ wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz +$ gunzip GeoLiteCity.dat.gz +$ rm GeoLiteCity.dat.gz +``` +5) Then enable and start service ```sh $ systemctl enable geostat.service $ systemctl start geostat.service diff --git a/geoparser.py b/geoparser.py index aa0e247..c042a78 100755 --- a/geoparser.py +++ b/geoparser.py @@ -76,4 +76,4 @@ if __name__ == '__main__': try: main() except KeyboardInterrupt: - os.system('clear') + sys.exit(0) diff --git a/install.sh b/install.sh index 9e3b495..3aeae42 100755 --- a/install.sh +++ b/install.sh @@ -4,6 +4,14 @@ ## Installetion script for GeoStat ## Alexey Nizhegolenko 2018 ## + +echo "" +echo "Downloading latest GeoLiteCity.dat from MaxMind" +sleep 1 +wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz +gunzip GeoLiteCity.dat.gz +rm GeoLiteCity.dat.gz + echo "" echo "Creating virtual ENV and installing requirements..." sleep 1