Added some changes with new GEOIP data file and fix some BUGs
This commit is contained in:
parent
04f43c4bc6
commit
26be286582
4 changed files with 19 additions and 13 deletions
|
@ -60,8 +60,9 @@ $ cp geostat.service /lib/systemd/system/
|
||||||
```
|
```
|
||||||
3) Download latest GeoLiteCity.dat from MaxMind
|
3) Download latest GeoLiteCity.dat from MaxMind
|
||||||
```sh
|
```sh
|
||||||
$ wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
|
$ wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
|
||||||
$ gunzip GeoLiteCity.dat.gz
|
$ tar -xvf GeoLite2-City.tar.gz
|
||||||
|
$ cp ./GeoLite2-City_some-date/GeoLite2-City.mmdb ./
|
||||||
```
|
```
|
||||||
4) Then enable and start service
|
4) Then enable and start service
|
||||||
```sh
|
```sh
|
||||||
|
|
|
@ -25,7 +25,7 @@ def logparse(LOGPATH, INFLUXHOST, INFLUXPORT, INFLUXDBDB, INFLUXUSER, INFLUXUSER
|
||||||
username=INFLUXUSER, password=INFLUXUSERPASS, database=INFLUXDBDB) # NOQA
|
username=INFLUXUSER, password=INFLUXUSERPASS, database=INFLUXDBDB) # NOQA
|
||||||
|
|
||||||
re_IPV4 = re.compile('(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})')
|
re_IPV4 = re.compile('(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})')
|
||||||
re_IPV6 = re.compile('(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))')
|
re_IPV6 = re.compile('(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))') # NOQA
|
||||||
|
|
||||||
GI = geoip2.database.Reader(GEOIPDB)
|
GI = geoip2.database.Reader(GEOIPDB)
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,16 @@
|
||||||
## Alexey Nizhegolenko 2018
|
## Alexey Nizhegolenko 2018
|
||||||
##
|
##
|
||||||
|
|
||||||
|
WORKDIR=$(pwd)
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Downloading latest GeoLiteCity.dat from MaxMind"
|
echo "Downloading latest GeoLiteCity.dat from MaxMind"
|
||||||
sleep 1
|
sleep 1
|
||||||
wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
|
wget https://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
|
||||||
gunzip GeoLiteCity.dat.gz
|
mkdir tmpgeo
|
||||||
|
tar -xvf GeoLite2-City.tar.gz -C ./tmpgeo && cd ./tmpgeo/*/.
|
||||||
|
cp ./GeoLite2-City.mmdb $WORKDIR
|
||||||
|
cd $WORKDIR
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Creating virtual ENV and installing requirements..."
|
echo "Creating virtual ENV and installing requirements..."
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
logpath = /var/log/nginx/access.log
|
logpath = /var/log/nginx/access.log
|
||||||
|
|
||||||
[GEOIP]
|
[GEOIP]
|
||||||
geoipdb = /usr/local/share/GeoIP/GeoLite2-City.mmdb
|
#Path for the GEOIP DB file
|
||||||
# For country use /usr/local/share/GeoIP/GeoLite2-Country.mmdb
|
geoipdb = ./GeoLite2-City.mmdb
|
||||||
|
|
||||||
[INFLUXDB]
|
[INFLUXDB]
|
||||||
# Database URL
|
# Database URL
|
||||||
|
|
Loading…
Reference in a new issue