nar*_*jja 6 csv elasticsearch logstash kibana
我有一个包含CSV的列latitude,longitude并且尝试geopoint在Logstash 2.3.3中创建一个对象,以便可以在Kibana 4.5.1中可视化这些值。
但是,当在Kibana中可视化数据时,我看到location.lat和location.lon,都是type float而不是locationtype 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 {}
}
Run Code Online (Sandbox Code Playgroud)
我指定的模板文件(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" }
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果有人可以帮助我或让我对我做错了什么有深刻的了解,我将不胜感激。另外,我确信这将为与我同舟共济的所有人提供帮助。
我解决了它,现在可以正常工作了。模板正在寻找类型的索引,logstash-*而我正在使用testindex1。更改索引以logstash-%{+dd.MM.YYYY}修复它。
您需要删除最后一个mutate过滤器,这会破坏您要达到的目的。
另外,您还需要确保testindex1映射忠实地包含elasticsearch-template.json文件中的映射
| 归档时间: |
|
| 查看次数: |
2934 次 |
| 最近记录: |