如果在我的日志中打印给定点的纬度和经度,我如何捕获此信息以便在弹性搜索中将其作为地理空间数据处理?
下面我将展示Elasticsearch中与日志行对应的文档示例:
{
"_index": "memo-logstash-2018.05",
"_type": "doc",
"_id": "DDCARGMBfvaBflicTW4-",
"_version": 1,
"_score": null,
"_source": {
"type": "elktest",
"message": "LON: 12.5, LAT: 42",
"@timestamp": "2018-05-09T10:44:09.046Z",
"host": "f6f9fd66cd6c",
"path": "/usr/share/logstash/logs/docker-elk-master.log",
"@version": "1"
},
"fields": {
"@timestamp": [
"2018-05-09T10:44:09.046Z"
]
},
"highlight": {
"type": [
"@kibana-highlighted-field@elktest@/kibana-highlighted-field@"
]
},
"sort": [
1525862649046
]
}
答案 0 :(得分:0)
您可以先将LON
和LAT
分隔到自己的字段中,如下所示,
grok {
match => {"message" => "LON: %{NUMBER:LON}, LAT: %{NUMBER:LAT}"}
}
一旦它们分开,你可以使用mutate过滤器在它们周围创建一个父字段,如下所示,
filter {
mutate {
rename => { "LON" => "[location][LON]" }
rename => { "LAT" => "[location][LAT]" }
}
}
请告诉我这是否有帮助。