elk收集nginx日志展示在中国地图

发布时间 2023-06-14 15:29:38作者: 技术颜良

 

https://github.com/cheyunhua/grafana-china-map-plugin

 

 

input {
file {
path => "/home/nginx/logs/cloud_dispatch_game-*.log"
type => "nginx"
start_position => "beginning"
codec => json
}
}
filter {
geoip {
source => "http_x_forwarded_for"
target => "geoip"
database => "/etc/logstash/GeoLite2-City_20191119/GeoLite2-City.mmdb"
fields => ["country_name","region_name","longitude","latitude"]
#add_field => ["[geoip][coordinates]","%{[geoip][longitude]}"]
#add_field => ["[geoip][coordinates]","%{[geoip][latitude]}"]
}
}

output {
elasticsearch {
hosts=>["192.168.x.x:9200"]
index=>"cloud_dispatch_game-%{+YYYY.MM.dd}"
}
}
#output {
# stdout{
# codec=>rubydebug
# }
#}