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

 

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

 https://www.cnblogs.com/sky-cheng/p/11899316.html

 

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
# }
#}

 

 

模拟请求    curl --header  "X-Forwarded-For: 101.101.101.101" xx.xx.xx.xx:14041/api/status

posted @ 2023-06-14 15:27  技术颜良  阅读(78)  评论(0编辑  收藏  举报