文章目录
一. 通过地图统计客户 IP 所在城市
官网
https://dev.maxmind.com/
下载地址
https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
geoip2-golang 项目地址 :
https://github.com/search?q=GeoLite2-City
1. 下载并安装geolite文件
在logstash安装
cd /etc/logstash/
wget http://geolite.maxmind.com/download/geoip/database/GeoLite2-City.tar.gz
logstash]# tar xvf GeoLite2-City.tar.gz
2. 配置 logstash 使用地址库
其中 elasticsearch的索引名称
必须必须必须以 logstash-开头
cat conf.d/redis-es.conf
input {
redis {
host => "192.168.15.12"
port => "6379"
db => "1"
key => "system-log-1512"
data_type => "list"
password => "123456"
}
redis {
host => "192.168.15.12"
port => "6379"
db => "0"
key => "tomcat-accesslog-1512"
data_type => "list"
password => "123456"
codec => "json"