sunilrxg
sunilrxg

Reputation: 113

Convert lat and lon to geoshape point in logstash conf?

How to stash input values such as lat and lon to create geoshape point before output to elasticsearch example need to output to elasticsearch as "location": { "type": "point", "coordinates": [-84.636,33.33] } For generating the above what code what filter should add in logstash conf file?

Upvotes: 0

Views: 451

Answers (1)

sunilrxg
sunilrxg

Reputation: 113

guys got the answer for this after a long search. its like this If you want to stash lat lon in to elasticsearch which already has mapping as

"location": {
            "type": "geo_shape"
          }

On your conf file in logstash you will have to use the filter mutate

mutate {
     add_field => { "[location][type]" => "point"
                    "[location][coordinates]" => ["%{LocationDataLng}",
                    "%{LocationDataLat}"]
     }
   }

Upvotes: 0

Related Questions