Welcome! Log In Create A New Profile

Advanced

Re: GeoIP data in access_log Nginx

July 28, 2015 08:42AM
Hello Maxim,

Thanks for the reply, you are the best ;)

I would like to add the GeoIP data into my log access to facilitate processing in Kibana (ELK stack)
Maybe is not the good way because i know it possible to do this with LogStash (GeoIP Filter), and this would reduce pressure Nginx (what do you think ?)

#Conf GEOIP (Load GeoIP Lib) => Downloaded on maxmind website
geoip_country /var/lib/GeoIP/GeoIP.dat;
geoip_city /var/lib/GeoIP/GeoLiteCity.dat;

#My log format
log_format main
'$host $remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for" "$request_time" "$upstream_cache_status" "$gzip_ratio" "$geoip_country_code"';

=> it works well with "$geoip_country_code"

my.domain.fr xxx.xxx.xxx.xxx - - [28/Jul/2015:14:29:38 +0200] "GET /test.jpg HTTP/1.0" 200 270225 "-" "Wget/1.12 (linux-gnu)" "-" "0.048" "MISS" "-" "FR"

Merci, thanks again.
Best regards,
Jugurtha
Subject Author Posted

GeoIP data in access_log Nginx

Jugurtha July 27, 2015 05:10AM

Re: GeoIP data in access_log Nginx

Maxim Dounin July 27, 2015 01:02PM

Re: GeoIP data in access_log Nginx

Jugurtha July 28, 2015 08:42AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 182
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready