Geo_point: adding a field from other fields gets wrong values

Hello everyone,

In my configuration file in logstash i want to add a field from other fields in order to get their values in order to use tilemap on kibana. I achieved to create this field and to convert it as a geo_point. However, this field doesn't have the right value. Here is what i did:

I am treating as an input a json file where I have gps coordinates of devices. The format of my file is as follows:
"server": {
"longitude": 56.8605769,
"latitude": 12.181989,

When I run logstash I get from the previous json file the following fields: server.latitude and server.longitude

I want to display those coordinates, that why i used the following configuration file in logstash:
input {
stdin { }
file {
path => ["path/to/tata.json"]
type => "myclientdata"
codec => "json"
start_position => "beginning"
filter {
mutate {
#add_field => ["[location][lat]", "56.8605769"] (with thoses values it works)
#add_field => ["[location][lon]", "12.181989"]
add_field => ["[location][lon]", "%{server.longitude}"] #(with thoses fields it does not work !!)
add_field => ["[location][lat]", "%{server.latitude}"]
mutate {
convert => {
"[location][lat]" => "float"
"[location][lon]" => "float"
output {
elasticsearch {
hosts => ["localhost:9200"]
index => "myclientdata"
stdout { codec => rubydebug }

I also excute a curl command to tell my server to consider 'location' as a geo_point and it works.

But At the end when i display location i have:
"location": {
"lon": 0,
"lat": 0

So please, do you have an idea how to manipulate my field location in function of server.latitude and server.longitude in order to get the righ values ?

Thanks a lot !!


add_field => ["[location][lon]", "%{server.longitude}"] #(with thoses fields it does not work !!)

Use %{[server][longitude]}.

1 Like

Thanks a lot Magnus, it works very well now :smiley: !!