Code Monkey home page Code Monkey logo

geoip2influx's Introduction

Docker Cloud Build Status Docker Image Size (latest by date) Docker Pulls GitHub Discord


A python script that will parse the nginx access.log and send geolocation metrics and log metrics to InfluxDB

For the linuxserver/letsencrypt docker mod, click here : https://github.com/linuxserver/docker-mods/tree/swag-geoip2influx


Usage

Enviroment variables:

These are the default values for all envs. Add the ones that differ on your system.

Environment Variable Example Value Description
NGINX_LOG_PATH /config/log/nginx/access.log Container path for Nginx logfile , defaults to the example.
INFLUX_HOST localhost Host running InfluxDB.
INFLUX_HOST_PORT 8086 Optional, defaults to 8086.
INFLUX_DATABASE geoip2influx Optional, defaults to geoip2influx.
INFLUX_USER root Optional, defaults to root.
INFLUX_PASS root Optional, defaults to root.
GEO_MEASUREMENT geoip2influx InfluxDB measurement name for geohashes. Optional, defaults to the example.
LOG_MEASUREMENT nginx_access_logs InfluxDB measurement name for nginx logs. Optional, defaults to the example.
SEND_NGINX_LOGS true Set to false to disable nginx logs. Optional, defaults to true.
GEOIP2INFLUX_LOG_LEVEL info Sets the log level in geoip2influx.log. Use debug for verbose logging Optional, defaults to info.
GEOIP2INFLUX_LOG_PATH /config/log/geoip2influx/geoip2influx.log Optional. Defaults to example.
GEOIP_DB_PATH /config/geoip2db/GeoLite2-City.mmdb Optional. Defaults to example.
INFLUX_RETENTION 7d Sets the retention for the database. Optional, defaults to example.
INFLUX_SHARD 1d Set the shard for the database. Optional, defaults to example.
MAXMINDDB_LICENSE_KEY xxxxxxx Add your Maxmind licence key
MAXMINDDB_USER_ID xxxxxxx Add your Maxmind account id

MaxMind Geolite2

Default download location is /config/geoip2db/GeoLite2-City.mmdb

Get your licence key here: https://www.maxmind.com/en/geolite2/signup

InfluxDB

InfluxDB v2.x is not supported. Use v1.8x.

The InfluxDB database will be created automatically with the name you choose.

-e INFLUX_DATABASE=geoip2influx 

Docker

docker create \
  --name=geoip2influx \
  -e PUID=1000 \
  -e PGID=1000 \
  -e TZ=Europe/Oslo \
  -e INFLUX_HOST=<influxdb host> \
  -e INFLUX_HOST_PORT=<influxdb port> \
  -e MAXMINDDB_LICENSE_KEY=<license key>\
  -e MAXMINDDB_USER_ID=<account id>\
  -v /path/to/appdata/geoip2influx:/config \
  -v /path/to/nginx/accesslog/:/config/log/nginx/ \
  --restart unless-stopped \
  ghcr.io/gilbn/geoip2influx

Docker compose

version: "2.1"
services:
  geoip2influx:
    image: ghcr.io/gilbn/geoip2influx
    container_name: geoip2influx
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Oslo
      - INFLUX_HOST=<influxdb host>
      - INFLUX_HOST_PORT=<influxdb port>
      - MAXMINDDB_LICENSE_KEY=<license key>
      - MAXMINDDB_USER_ID=<account id>
    volumes:
      - /path/to/appdata/geoip2influx:/config
      - /path/to/nginx/accesslog/:/config/log/nginx/
    restart: unless-stopped

Grafana dashboard:

Needs the grafana-worldmap-panel


Sending Nginx log metrics

Nginx needs to be compiled with the geoip2 module: https://github.com/leev/ngx_http_geoip2_module

  1. Add the following to the http block in your nginx.conf file:
geoip2 /config/geoip2db/GeoLite2-City.mmdb {
auto_reload 5m;
$geoip2_data_country_iso_code country iso_code;
$geoip2_data_city_name city names en;
}

log_format custom '$remote_addr - $remote_user [$time_local]'
           '"$request" $status $body_bytes_sent'
           '"$http_referer" $host "$http_user_agent"'
           '"$request_time" "$upstream_connect_time"'
           '"$geoip2_data_city_name" "$geoip2_data_country_iso_code"';
  1. Set the access log use the custom log format.
access_log /config/log/nginx/access.log custom;

Multiple log files

If you separate your nginx log files but want this script to parse all of them you can do the following:

As nginx can have multiple access log directives in a block, just add another one in the server block.

Example

	access_log /config/log/nginx/technicalramblings/access.log custom;
	access_log /config/log/nginx/access.log custom;

This will log the same lines to both files.

Then use the /config/log/nginx/access.log file in the NGINX_LOG_PATH variable.


Updates

06.08.24 - Complete refactor of the python code. Deprecate the old geoip2influx.py file.

28.07.24 - Refactor to alpine 3.20. New env required. MAXMINDDB_USER_ID.

21.06.20 - Added $host(domain) to the nginx log metrics. This will break your nginx logs parsing, as you need to update the custom log format.

06.06.20 - Added influx retention policy to try and mitigate max-values-per-tag limit exceeded errors.

  • -e INFLUX_RETENTION Default 30d
  • -e INFLUX_SHARD Default 2d
  • It will only add the retention policy if the database doesn't exist.

30.05.20 - Added logging. Use -e GEOIP2INFLUX_LOG_LEVEL to set the log level.

15.05.20 - Removed GEOIP2_KEY and GEOIP_DB_PATHvariables. With commit https://github.com/linuxserver/docker-letsencrypt/commit/75b9685fdb3ec6edda590300f289b0e75dd9efd0 the letsencrypt container now natively supports downloading and updating(weekly) the GeoLite2-City database!


Adapted source: https://github.com/ratibor78/geostat

geoip2influx's People

Contributors

drizuid avatar gilbn avatar wollsi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

geoip2influx's Issues

SWAG Logs filling up with geoip2influx warnings

Hi, I followed your guide at technicalramblings on how to get nginx geo information into grafana. So far its works well but my swag container log is filling up with geoip2influx warnings almost every second. Copied a few over as the warning said.
I dont really know how to fix that as everything else seems to work fine grafana shows logs and positions as it should.
I would very appreciate your help on how to fix or eliminate those warnings, thanks in advance!

LOGS:

GEOIP2INFLUX 14/Sep/2021 15:38:54 :: INFO :: Starting geoip2influx..
GEOIP2INFLUX 14/Sep/2021 15:38:54 :: INFO :: Starting log parsing
GEOIP2INFLUX 14/Sep/2021 15:39:07 :: WARNING :: Failed to match regex that previously matched!? Skipping this line!

If you think the regex should have mathed the line, please share the log line below on https://discord.gg/HSPa4cz or Github: https://github.com/gilbN/geoip2influx
Line: 154.16.192.XXX - - [14/Sep/2021:15:39:06 +0200] "GET /api/history/period/2021-09-13T13:39:04.831Z?filter_entity_id=sensor.fritz_box_7530_kb_s_received,sensor.fritz_box_7530_kb_s_sent,sensor.google,sensor.hyperion&end_time=2021-09-14T13:39:04.831Z&minimal_response HTTP/2.0" 200 117101 "https://homeassistant.DOMAIN.de/lovelace/wg-home" "Mozilla/5.0 (Linux; Android 11; AC2003 Build/RP1A.201005.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/93.0.4577.62 Mobile Safari/537.36"


GEOIP2INFLUX 14/Sep/2021 15:39:07 :: WARNING :: Failed to match regex that previously matched!? Skipping this line!

If you think the regex should have mathed the line, please share the log line below on https://discord.gg/HSPa4cz or Github: https://github.com/gilbN/geoip2influx
Line: 154.16.192.XXX - - [14/Sep/2021:15:39:06 +0200] "GET /api/history/period/2021-09-13T13:39:04.831Z?filter_entity_id=sensor.fritz_box_7530_kb_s_received,sensor.fritz_box_7530_kb_s_sent,sensor.google,sensor.hyperion&end_time=2021-09-14T13:39:04.831Z&minimal_response HTTP/2.0" 200 117101 "https://homeassistant.DOMAIN.de/lovelace/wg-home" "Mozilla/5.0 (Linux; Android 11; AC2003 Build/RP1A.201005.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/93.0.4577.62 Mobile Safari/537.36"


GEOIP2INFLUX 14/Sep/2021 15:39:38 :: WARNING :: Failed to match regex that previously matched!? Skipping this line!

If you think the regex should have mathed the line, please share the log line below on https://discord.gg/HSPa4cz or Github: https://github.com/gilbN/geoip2influx
Line: 154.16.192.XXX - - [14/Sep/2021:15:39:38 +0200] "GET /api/history/period/2021-09-13T13:39:36.266Z?filter_entity_id=sensor.fritz_box_7530_kb_s_received,sensor.fritz_box_7530_kb_s_sent,sensor.google,sensor.hyperion&end_time=2021-09-14T13:39:36.266Z&minimal_response HTTP/2.0" 200 117093 "https://homeassistant.DOMAIN.de/lovelace/wg-home" "Mozilla/5.0 (Linux; Android 11; AC2003 Build/RP1A.201005.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/93.0.4577.62 Mobile Safari/537.36"

nginx.conf edits:

geoip2 /config/geoip2db/GeoLite2-City.mmdb {
     auto_reload 5m;
     $geoip2_data_country_iso_code country iso_code;
     $geoip2_data_city_name city names en;
 }

 log_format custom '$remote_addr - $remote_user [$time_local]'
        '"$request" $status $body_bytes_sent'
        '"$http_referer" $host "$http_user_agent"'
        '"$request_time" "$upstream_connect_time"'
        '"$geoip2_data_city_name" "$geoip2_data_country_iso_code"';
 
 access_log /config/log/nginx/access.log custom;

Uknown log format

Hello,

Im pretty new to the world of webistes and logging, im gosting my own website now and tried to use your awesome plugin.
bet i keep getting these errors.
afbeelding

this is my .conf file
afbeelding

what am i doing wrong? could you give me a push in the right way?

Thank you for your work and help.

with kind regards.

GEOIP2INFLUX loops at Starting log parsing

I can't get GEOIP2INFLUX to send data, the regex matches, but the container keeps looping at Starting log parsing.
I've copied a example access.log snippet below, it has internal and external requests, but that should be fine.

access.log:

x.x.x.x- - [07/Apr/2021:12:48:04 +0000]"GET / HTTP/1.1" 200 7480"-" mydomain.com "curl/7.64.0""0.047" "0.004""Munich" "DE"
x.x.x.x- - [07/Apr/2021:12:48:06 +0000]"GET / HTTP/1.1" 200 7480"-" mydomain.com "curl/7.64.0""0.038" "0.000""Munich" "DE"
10.10.10.142 - user [07/Apr/2021:12:48:06 +0000]"PROPFIND /remote.php HTTP/1.1" 207 261"-" service.mydomain.com "Mozilla/5.0 (Linux) mirall/3.1.2git (service)""0.099" "0.004""-" "-"
x.x.x.x- - [07/Apr/2021:12:48:06 +0000]"GET / HTTP/1.1" 200 7480"-" mydomain.com "curl/7.64.0""0.042" "0.000""Munich" "DE"
x.x.x.x- - [07/Apr/2021:12:48:07 +0000]"GET / HTTP/1.1" 200 7480"-" mydomain.com "curl/7.64.0""0.043" "0.000""Munich" "DE"

docker-compose.yaml

 version: '3'
 services:
  geoip2influx:
    image: gilbn/geoip2influx
    container_name: monitoring-geoip
    restart: unless-stopped
    environment:
      - PUID=1000
      - PGID=1000
      - TZ=Europe/Berlin
      - INFLUX_HOST=10.10.10.10
      - INFLUX_HOST_PORT=8086
      - INFLUX_DATABASE=nginx
      - INFLUX_USER=user
      - INFLUX_PASS=pass
      - GEOIP2INFLUX_LOG_LEVEL=debug
      - SEND_NGINX_LOGS=False
      - MAXMINDDB_LICENSE_KEY=xxxxxxx
    volumes:
      - geoip-storage:/config
      - ./Geoip2Influx/:/config/log/nginx/
volumes:
  geoip-storage:

container log:

usermod: no changes
-------------------------------------
          _         ()
         | |  ___   _    __
         | | / __| | |  /  \ 
         | | \__ \ | | | () |
         |_| |___/ |_|  \__/
Brought to you by linuxserver.io
-------------------------------------
To support LSIO projects visit:
https://www.linuxserver.io/donate/
-------------------------------------
GID/UID
-------------------------------------
User uid:    1000
User gid:    1000
-------------------------------------
[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 50-config: executing... 
Variables set:
NGINX_LOG_PATH=
INFLUX_HOST=10.10.10.10
INFLUX_HOST_PORT=8086
INFLUX_DATABASE=nginx
INFLUX_USER=user
INFLUX_PASS=password
INFLUX_RETENTION=
INFLUX_SHARD=
GEO_MEASUREMENT=
LOG_MEASUREMENT=
SEND_NGINX_LOGS=False
GEOIP2INFLUX_LOG_LEVEL=debug
GEOIP2INFLUX_LOG_PATH=
MAXMINDDB_LICENSE_KEY=xxxxxxx
[cont-init.d] 50-config: exited 0.
[cont-init.d] 99-custom-files: executing... 
[custom-init] no custom files found exiting...
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: INFO :: Starting geoip2influx..
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: DEBUG :: Variables set:
 geoip_db_path             :: /config/geoip2db/GeoLite2-City.mmdb
 -e LOG_PATH               :: /config/log/nginx/access.log
 -e INFLUX_HOST            :: 10.10.10.10
 -e INFLUX_HOST_PORT       :: 8086
 -e INFLUX_DATABASE        :: nginx
 -e INFLUX_RETENTION       :: 7d
 -e INFLUX_SHARD           :: 1d
 -e INFLUX_USER            :: user
 -e INFLUX_PASS            :: password
 -e GEO_MEASUREMENT        :: geoip2influx
 -e LOG_MEASUREMENT        :: nginx_access_logs
 -e SEND_NGINX_LOGS        :: False
 -e GEOIP2INFLUX_LOG_LEVEL :: DEBUG
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: DEBUG :: Found: /config/log/nginx/access.log
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: DEBUG :: Found: /config/geoip2db/GeoLite2-City.mmdb
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: DEBUG :: Testing InfluxDB connection
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: DEBUG :: Starting new HTTP connection (1): 10.10.10.10:8086
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: DEBUG :: http://10.10.10.10:8086 "GET /ping HTTP/1.1" 204 0
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: DEBUG :: Influxdb version: 1.8.4
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: DEBUG :: http://10.10.10.10:8086 "GET /query?q=SHOW+DATABASES&db=nginx HTTP/1.1" 200 None
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: INFO :: Creating database: nginx
GEOIP2INFLUX 07/Apr/2021 15:16:29 :: DEBUG :: http://10.10.10.10:8086 "POST /query?q=CREATE+DATABASE+%22nginx%22&db=nginx HTTP/1.1" 200 None
GEOIP2INFLUX 07/Apr/2021 15:16:30 :: DEBUG :: http://10.10.10.10:8086 "GET /query?q=SHOW+RETENTION+POLICIES+ON+%22nginx%22&db=nginx HTTP/1.1" 200 None
GEOIP2INFLUX 07/Apr/2021 15:16:30 :: INFO :: Creating nginx retention policy (7d-1d)
GEOIP2INFLUX 07/Apr/2021 15:16:30 :: DEBUG :: http://10.10.10.10:8086 "POST /query?q=CREATE+RETENTION+POLICY+%22nginx+7d-1d%22+ON+%22nginx%22+DURATION+7d+REPLICATION+1+SHARD+DURATION+1d+DEFAULT&db=nginx HTTP/1.1" 200 None
GEOIP2INFLUX 07/Apr/2021 15:16:30 :: INFO :: SEND_NGINX_LOGS set to false
GEOIP2INFLUX 07/Apr/2021 15:16:30 :: DEBUG :: Regex is matching /config/log/nginx/access.log continuing...
GEOIP2INFLUX 07/Apr/2021 15:16:30 :: INFO :: Starting log parsingGEOIP2INFLUX 07/Apr/2021 15:17:03 :: DEBUG :: Found: /config/log/nginx/access.log
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: DEBUG :: Found: /config/geoip2db/GeoLite2-City.mmdb
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: DEBUG :: Testing InfluxDB connection
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: DEBUG :: Starting new HTTP connection (1): 10.10.10.10:8086
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: DEBUG :: http://10.10.10.10:8086 "GET /ping HTTP/1.1" 204 0
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: DEBUG :: Influxdb version: 1.8.4
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: DEBUG :: http://10.10.10.10:8086 "GET /query?q=SHOW+DATABASES&db=nginx HTTP/1.1" 200 None
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: DEBUG :: Found database: nginx
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: INFO :: SEND_NGINX_LOGS set to false
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: DEBUG :: Regex is matching /config/log/nginx/access.log continuing...
GEOIP2INFLUX 07/Apr/2021 15:17:03 :: INFO :: Starting log parsing
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: DEBUG :: Found: /config/log/nginx/access.log
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: DEBUG :: Found: /config/geoip2db/GeoLite2-City.mmdb
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: DEBUG :: Testing InfluxDB connection
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: DEBUG :: Starting new HTTP connection (1): 10.10.10.10:8086
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: DEBUG :: http://10.10.10.10:8086 "GET /ping HTTP/1.1" 204 0
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: DEBUG :: Influxdb version: 1.8.4
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: DEBUG :: http://10.10.10.10:8086 "GET /query?q=SHOW+DATABASES&db=nginx HTTP/1.1" 200 None
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: DEBUG :: Found database: nginx
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: INFO :: SEND_NGINX_LOGS set to false
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: DEBUG :: Regex is matching /config/log/nginx/access.log continuing...
GEOIP2INFLUX 07/Apr/2021 15:18:03 :: INFO :: Starting log parsing

Get error message when influxdb docker updated 5 days ago

It work well until the influxdb docker image ( influxdb:latest ) updated 5 days ago.

Here is the error message:
GEOIP2INFLUX 25/Feb/2021 12:09:46 :: INFO :: Starting geoip2influx..
GEOIP2INFLUX 25/Feb/2021 12:09:46 :: CRITICAL :: Error getting database list! Please check your InfluxDB configuration.
Error: 401: {"code":"unauthorized","message":"Unauthorized"}

Thank you!

nginx_access_logs measurement not going to influx

I'm having trouble shipping the nginx_access_logs measurement to influx. It is likely a configuration error but I'm not having any success at the moment. My current config is blow.

version: "2.1"
services:
geoip2influx:
image: gilbn/geoip2influx
container_name: geoip2influx
environment:
- PUID=1000
- PGID=1000
- TZ=America/New_York
- INFLUX_HOST=xxx.xxx.xx.xx
- INFLUX_HOST_PORT=xxx
- MAXMINDDB_LICENSE_KEY=xxxxx
- INFLUX_DATABASE=docker1
- GEOIP2INFLUX_LOG_LEVEL=debug
- SEND_NGINX_LOGS=true
- LOG_MEASUREMENT=nginx_access_logs
volumes:
- /home/castanets/geo/:/config
- /var/log/nginx/:/config/log/nginx/

Thank you for developing an excellent tool!

Recommended memory ?

Hi ,

First of all, great dashboard and script works really nicely and gives a ton of useful information.

Are you able to advise on what specs should be used for this? I found that running it for 3/4 hours after accumlating data , it starts slowing down and influxdb uses a ton of memory (vm only has 4GB as it's only running nginx) so quickly ends up in swap. I was thinking of offloading processing for it elsewhere to take the load off nginx. I just figured being a docker instance, the footprint might be a bit smaller.

If you think this is more of an influxDB issue, I am happy to be told to go elsewhere :) . Nginx is quite busy I had 20,000+ total requests for the 3-4 hours I had it running.

Many thanks,

grafana dashboard ALL selection not working?

Hey,
I couldn't find anything after searching for this. It seems like the ALL selection in the drop-down isn't doing what it should. I have the default of all selected and no data gets displayed. Then if I go in and make selections instead of all data shows up. I've also tried modifying the query as below and this works to display some data as well.

Original: SELECT sum("bytes_sent") FROM "nginx_access_logs" WHERE ("ip" !~ /^$excluded_ip$/ AND "city" =~ /^$city$/ AND "country_code" =~ /^$country_code$/ AND "country_name" =~ /^$country$/ AND "host" =~ /^$domain$/) AND $timeFilter GROUP BY time($__interval) fill(null)
Modified: SELECT sum("bytes_sent") FROM "nginx_access_logs" WHERE ("ip" !~ /^$excluded_ip$/) AND $timeFilter GROUP BY time($__interval) fill(null)

I also noticed clicking all doesn't actually select all of the ones below, just selects the one all box:
image

Clicking on selected twice does place a check into all of the entries, but I imagine this would have to be done frequently to update all of the selections
image

Unknown city : stat ignored

Hello

thank for your mod this is really helpfull :)

I have a little issue I don't know if it's a feature or a bug:
sometime I have the country but not the city. The log is pushed into the influxdb no problem. But in the dashboard all the lines with no cities seems to be ignored.

Example with an IP for France :

In access.geoip.log

109.236.192.1 - - [10/Jan/2022:12:24:45 +0100]"GET /index.php/about/ HTTP/2.0" 200 9023"-" devnull.crapules.com "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36""0.091" "0.000""-" "FR"
109.236.192.1 - - [10/Jan/2022:12:24:45 +0100]"GET /favicon.ico HTTP/2.0" 302 0"https://devnull.crapules.com/index.php/about/" devnull.crapules.com "Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36""0.068" "0.000""-" "FR"

seems to be well pushed into influxdb:

GEOIP2INFLUX 10/Jan/2022 12:24:45 :: DEBUG :: Geo metrics: [{'tags': {'geohash': 'u09tvnqgxst5', 'ip': '109.236.192.1', 'host': '1aa1bc406889', 'country_code': 'FR', 'country_name': 'France', 'state': None, 'state_code': None, 'city': None, 'postal_code': None, 'latitude': 48.8582, 'longitude': 2.3387}, 'fields': {'count': 1}, 'measurement': 'geoip2influx'}]
GEOIP2INFLUX 10/Jan/2022 12:24:45 :: DEBUG :: http://MyIP:8086 "POST /write?db=mydb HTTP/1.1" 204 0
GEOIP2INFLUX 10/Jan/2022 12:24:45 :: DEBUG :: NGINX log metrics: [{'tags': {'ip': '109.236.192.1', 'datetime': datetime.datetime(2022, 1, 10, 12, 24, 45, tzinfo=datetime.timezone(datetime.timedelta(seconds=3600))), 'remote_user': '-', 'method': 'GET', 'referrer': '/index.php/about/', 'host': 'devnull.crapules.com', 'http_version': 'HTTP/2.0', 'status_code': '200', 'bytes_sent': '9023', 'url': '-', 'user_agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36', 'request_time': '0.091', 'connect_time': '0.000', 'city': '-', 'country_code': 'FR', 'country_name': 'France'}, 'fields': {'count': 1, 'bytes_sent': 9023, 'request_time': 0.091, 'connect_time': 0.0}, 'measurement': 'nginx_access_logs'}]
GEOIP2INFLUX 10/Jan/2022 12:24:46 :: DEBUG :: http://MyIP:8086 "POST /write?db=mydb HTTP/1.1" 204 0
GEOIP2INFLUX 10/Jan/2022 12:24:46 :: DEBUG :: Geo metrics: [{'tags': {'geohash': 'u09tvnqgxst5', 'ip': '109.236.192.1', 'host': '1aa1bc406889', 'country_code': 'FR', 'country_name': 'France', 'state': None, 'state_code': None, 'city': None, 'postal_code': None, 'latitude': 48.8582, 'longitude': 2.3387}, 'fields': {'count': 1}, 'measurement': 'geoip2influx'}]
GEOIP2INFLUX 10/Jan/2022 12:24:46 :: DEBUG :: http://MyIP:8086 "POST /write?db=mydb HTTP/1.1" 204 0
GEOIP2INFLUX 10/Jan/2022 12:24:46 :: DEBUG :: NGINX log metrics: [{'tags': {'ip': '109.236.192.1', 'datetime': datetime.datetime(2022, 1, 10, 12, 24, 45, tzinfo=datetime.timezone(datetime.timedelta(seconds=3600))), 'remote_user': '-', 'method': 'GET', 'referrer': '/favicon.ico', 'host': 'devnull.crapules.com', 'http_version': 'HTTP/2.0', 'status_code': '302', 'bytes_sent': '0', 'url': 'https://devnull.crapules.com/index.php/about/', 'user_agent': 'Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36', 'request_time': '0.068', 'connect_time': '0.000', 'city': '-', 'country_code': 'FR', 'country_name': 'France'}, 'fields': {'count': 1, 'bytes_sent': 0, 'request_time': 0.068, 'connect_time': 0.0}, 'measurement': 'nginx_access_logs'}]
GEOIP2INFLUX 10/Jan/2022 12:24:46 :: DEBUG :: http://MyIP:8086 "POST /write?db=mydb HTTP/1.1" 204 0

Into my grafana dashboard the country FR don't appear :

image

If i'm editing the request (sorry i'm not a Grafana specialist) and remove the "city" filter I can see the data is present :

image

Sorry I probably miss something into the grafana dashboard

Thank you!

unknow file path

Great dashboard , thanks for sharing :D
please can you explain what is this path exactly /config/log/geoip2influx/geoip2influx.log ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.