Part of my matched message returns the fields
%{NUMBER:XCent} %{NUMBER:YCent}
which are lat, long points.
I'm attempting to add a location pin but keep getting a config failure when i use the --debug flag on my configuration file apparently it's expecting a # symbol???
if [XCent] and [YCent] {
"location" : {
"lat" : %{XCent},
"lon" : %{YCent},
"type" : "geo_point"
}
}
The mutate filter can only change between different JSON types and "geo_point" is an ES concept. To have a field mapped as geo_point I think you need to modify the mapping.
(For testing configurations you want the --configtest option, not --debug. Well, the latter will implicitly test the configuration upon startup but so will running Logstash without any such options.)
I've looked at the gioip filter rb files, and the elasticsearch.yml file. I'm not sure where I apply the mapping for the location field to cast it as a geo point. I also tried to use the geoip plugin and override the values as a work around, but it's just not coming together easily.
Thanks for the suggestion of the --configtest flag, it's made debugging a lot quicker!
Have a look at index templates. Logstash manages the index template for logstash-* indexes by default but you can override it and supply your own template (based on the Logstash default). In that template you can specify that your location field has the geo_point type.
Eventually the template is saved in the cluster itself, but you'll typically have a version-controlled source file somewhere (i.e. anywhere).
The simplest way is to make a copy of Logstash's template file (the exact path varies but IIRC the filename is elasticsearch-template.json) and point the template option of the elasticsearch output to it. Then modify the template to your needs, i.e. by adding a geo_point-typed field. When Logstash creates the next index after the configuration change (typically tomorrow's index) that index should have the correct mapping.
Another option is to disable Logstash's index template handling altogether with the manage_template option and post your tempate into the cluster on your own. That's what I prefer, but YMMV.
@spraveenjd, please start a new thread for your question, and when you do please ask a more specific question that includes information about what information you want to turn into a geo_point (an example event as produced by a stdout { codec => rubydebug } would be great) and your current configuration.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.