I wrote ruby code in logstash conf file like this
mutate {
add_field => {"[location]" => "[0,0]"}
}
ruby{
code => 'event.set("[location]", [(event.get("%{[lt][py]}").to_f * 5.6) / 10), event.get("[lt][px]"])) '
}
what i found in the logstash log file is that:
[2017-07-24T12:17:46,538][INFO ][logstash.outputs.elasticsearch] Running health check to see if an Elasticsearch connection is working {:healthcheck_url=>http://elastic:xxxxxx@127.0.0.1:9200/, :path=>"/"}
[2017-07-24T12:17:46,638][WARN ][logstash.outputs.elasticsearch] Restored connection to ES instance {:url=>#Java::JavaNet::URI:0x3dff0f9b}
[2017-07-24T12:17:46,639][INFO ][logstash.outputs.elasticsearch] Using mapping template from {:path=>nil}
[2017-07-24T12:17:46,666][INFO ][logstash.outputs.elasticsearch] Attempting to install template {:manage_template=>{"template"=>"logstash-", "version"=>50001, "settings"=>{"index.refresh_interval"=>"5s"}, "mappings"=>{"default"=>{"_all"=>{"enabled"=>true, "norms"=>false}, "dynamic_templates"=>[{"message_field"=>{"path_match"=>"message", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false}}}, {"string_fields"=>{"match"=>"", "match_mapping_type"=>"string", "mapping"=>{"type"=>"text", "norms"=>false, "fields"=>{"keyword"=>{"type"=>"keyword", "ignore_above"=>256}}}}}], "properties"=>{"@timestamp"=>{"type"=>"date", "include_in_all"=>false}, "@version"=>{"type"=>"keyword", "include_in_all"=>false}, "geoip"=>{"dynamic"=>true, "properties"=>{"ip"=>{"type"=>"ip"}, "location"=>{"type"=>"geo_point"}, "latitude"=>{"type"=>"half_float"}, "longitude"=>{"type"=>"half_float"}}}}}}}}
[2017-07-24T12:17:46,671][INFO ][logstash.outputs.elasticsearch] New Elasticsearch output {:class=>"LogStash::Outputs::ElasticSearch", :hosts=>[#Java::JavaNet::URI:0x4907425a]}
I couldn't find data in kibana. After i removed the ruby code logstash worked fine.
Does anyone know how to deal with that ?
Thanks,
Muhammad Abbas