Kibana8配置访问地图。
EFK集群升级8.13后创建Maps出现了问题,网上找不到,自己安装之前方式解决的。
错误日志:Data view does not contain any geospatial fields
解决思路:
新版本Mappings结构,可以看到比较7.10版本多了结构geo。
#旧7.10版本
"geoip": {
"dynamic": "true",
"properties": {
"city_name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
},
"norms": false
},
#新8.13版本
"geoip": {
"properties": {
"geo": {
"dynamic": "true",
"properties": {
"city_name": {
"type": "text",
"fields": {
"keyword": {
"type": "keyword",
"ignore_above": 256
}
}
},
.....
也可以在Data Views里面看到
且不论什么版本的geoip参数都是没有带Type:geo_point,需要修改你的Index Management。
所以根据这个思路,我们把旧版本的Index Management修改就行了。
1.logstash8.13配置geoip
修改logstash.conf
具体参数和安装.mmdb文件方法请参考我另外的置顶文章,下拉到EFK处。
filter {
if [fields][log_topic] == "istio-ingress" {
grok {
match => {
"message" => "\[%{TIMESTAMP_ISO8601:timestamp}\] \"%{WORD:verb} %{URIPATHPARAM:request} HTTP/%{NUMBER:http_version}\" %{INT:response} %{NOTSPACE:upstream_header} %{GREEDYDATA:upstream_error} %{NOTSPACE:upstream_error1} \"%{NOTSPACE:referrer}\" %{INT:bytes_in} %{INT:bytes_out} %{INT:duration} %{NOTSPACE:duration2} \"%{NOTSPACE:client_ip}\" \"%{GREEDYDATA:user_agent}\" \"%{UUID:request_id}\" \"%{HOSTNAME:hostname}\" \"%{GREEDYDATA:x_forwarded_for}\" %{GREEDYDATA:outbound_route} %{IPORHOST:destination_ip}:%{INT:destination_port0} %{IPORHOST:destination_ip}:%{INT:destination_port} %{IPORHOST:source_ip}:%{INT:source_port} %{HOSTNAME:source_hostname} %{NOTSPACE:after}"
}
}
geoip {
source => "source_ip"
target => "geoip"
database => "/mnt/GeoLite2-City_20230707/GeoLite2-City.mmdb"
}
}
}
修改完记得重启
2.kibana8.13添加Index Management
新建一个Index Management,并按照我的图步骤,没有的步骤则不需要修改。
{
"index": {
"number_of_shards": "1",
"refresh_interval": "5s"
}
}
最后保存后,Mappings长这样
{
"dynamic_templates": [],
"properties": {
"@timestamp": {
"type": "date"
},
"geoip": {
"type": "object",
"properties": {
"geo": {
"dynamic": true,
"type": "object",
"enabled": true,
"properties": {
"ip": {
"index": true,
"store": false,
"type": "ip",
"doc_values": true
},
"latitude": {
"type": "float"
},
"location": {
"type": "geo_point"
},
"longitude": {
"type": "float"
}
}
}
}
},
"@version": {
"type": "keyword"
}
}
}
3.创建Data Views
进入搜索location看是否存在geoip.geo.location,Type是geo_point。要有才行,没有就从头开始检查哪里和我的不一致。
4.创建Maps
打开maps并Add layer,选择Documents,或者其它你喜欢的。
选择你的Data Views,就可以看到预览了,后续style就自己自定义吧。
算是全网独家吧,帮忙点个赞了!!!