Hi Experts,
I had add 2 field with name lat,lon and value 21.033333, 105.849998 to index by logstash filter plugin "mutate"
if [fields][Contract] =~ "HNH" {
mutate {
add_field => [ "city", "Hanoi" ]
add_field => [ "lat", 21.033333 ]
add_field => [ "lon", 105.849998 ]
}
}
Then, i convert lat, lon to "float"
mutate {
convert => {
"lat" => "float"
"lon" => "float"
}
add_field => {
"[geoip][location]" => [ "%{lon}", "%{lat}" ]
"[geoip][latitude]" => "%{lat}"
"[geoip][longitude]" => "%{lon}"
}
}
But when start logstash, logstash show errror: "[2016-11-21T10:06:41,507][WARN ][logstash.outputs.elasticsearch] Failed action. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"logstash-test", :_type=>"fboxs", :_routing=>nil}, 2016-11-09T01:00:24.670Z 0.0.0.0 -], :response=>{"index"=>{"_index"=>"logstash-test", "_type"=>"fboxs", "_id"=>"AViE2ZLx_lz5mWQZHGac", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [geoip.latitude]", "caused_by"=>{"type"=>"number_format_exception", "reason"=>"For input string: "%{lat}""}}}}}"
How to fix it? Thanks.