gpt4 book ai didi

csv - 在 Logstash 中从 CSV(纬度和经度列)创建地理点对象

转载 作者:行者123 更新时间:2023-11-29 02:48:19 24 4
gpt4 key购买 nike

我有一个包含列 latitude 的 CSV和 longitude我正在尝试创建一个 geopoint Logstash 2.3.3 中的对象,以便我可以在 Kibana 4.5.1 中可视化这些值。

然而,当在 Kibana 中可视化数据时,我看到了 location.latlocation.lon , 都是 float 类型而不是 location类型 geopoint .

总的来说,我是 ELK 的新手,这让我发疯。特别是因为我找到的大部分信息都已过时。

.conf我正在使用的文件如下所示:

input {  
file {
path => "C:/file.csv"
start_position => "beginning"
}
}

filter {
csv {
separator => ","
columns => ["longitude","latitude"]
}

mutate { convert => {"latitude" => "float"} }
mutate { convert => {"longitude" => "float"} }
mutate { rename => {"latitude" => "[location][lat]"} }
mutate { rename => {"longitude" => "[location][lon]"} }
mutate { convert => { "[location]" => "float" } }
}

output {
elasticsearch {
template => "...\elasticsearch-template.json"
template_overwrite => true
action => "index"
hosts => "localhost"
index => "testindex1"
workers => 1
}
stdout {}
}

我指定的模板文件 ( elasticsearch-template.json ) 如下:

{
"template" : "logstash-*",
"settings" : {
"index.refresh_interval" : "5s"
},
"mappings" : {
"_default_" : {
"_all" : {"enabled" : true, "omit_norms" : true},
"dynamic_templates" : [ {
"message_field" : {
"match" : "message",
"match_mapping_type" : "string",
"mapping" : {
"type" : "string", "index" : "analyzed", "omit_norms" : true,
"fielddata" : { "format" : "disabled" }
}
}
}, {
"string_fields" : {
"match" : "*",
"match_mapping_type" : "string",
"mapping" : {
"type" : "string", "index" : "analyzed", "omit_norms" : true,
"fielddata" : { "format" : "disabled" },
"fields" : {
"raw" : {"type": "string", "index" : "not_analyzed", "ignore_above" : 256}
}
}
}
} ],
"properties" : {
"@timestamp": { "type": "date" },
"@version": { "type": "string", "index": "not_analyzed" },
"geoip" : {
"dynamic": true,
"properties" : {
"ip": { "type": "ip" },
"location" : { "type" : "geo_point" },
"latitude" : { "type" : "float" },
"longitude" : { "type" : "float" }
}
},
"location" : { "type": "geo_point" }
}
}
}
}

如果有人可以帮助我或让我了解我做错了什么,我将不胜感激。此外,我相信这会对与我在同一条船上的每个人有所帮助。

我解决了它,它现在工作得很好。模板正在寻找类型为 logstash-* 的索引。我用的是testindex1 .将我的索引更改为 logstash-%{+dd.MM.YYYY}修复它。

最佳答案

您需要删除最后一个 mutate 过滤器,它会破坏您想要实现的目的。

您还需要确保 testindex1 映射忠实地包含您在 elasticsearch-template.json 文件中的映射

关于csv - 在 Logstash 中从 CSV(纬度和经度列)创建地理点对象,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38002897/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com