I am working on a project where I have in my input data some coordinates in lambert. i would like to convert these coordinates in latitude and longitude. I found on internet a function in ruby to do it: https://github.com/yageek/lambert-ruby . However, I don't think I can use it in logstash. Then, do you know if there is a function or a plugin in logstash.
I have just one problem with my filter. Indeed, my filter works like this:
convert => ["typeLambert", x, y]
where:
typelambert is the type of lambert (string)
x is the lattitude in lamber (float type)
y is the longitude in lambert (float type)
where I write, for instance, convert => ["LambertIIExtended", 2478517.33, 547536.68] , it works well !
But, when I read a file or a kafka topic where I have parameters like below:
{"lati":2478517.33, "longi":547536.68}
{"lati":2699120.65, "longi":544959.56}
{"lati":2149001.71, "longi":588529.14}
It does not work when I write convert => ["LambertIIExtended", "%{[lati]}", "%{[longi]}"]
I printed the output results and ruby does not get the float value of my parameters lati and longi, it reads and prints them exactly like strings "%{[lati]}" and "%{[longi]}". Do you knwo how I could solve this ?
I put in Annexe my filter part. My logstash filter part:
filter {
lambert {
convert => ["LambertIIExtended", "%{[lati]}", "%{[longi]}"] #it does work because #convert => ["LambertIIExtended", 2478517.33, 547536.68] #it works
latitude => ["latnew"]
longitude => ["longnew"]
}
}
PS: if you need my ruby code, I can provide it. (it is just a little bit long that's why I did not add here)
@sen, any chance to see your code already, hosted somewhere like github ?
it would be easier to check how you are retrieving the event value,
It is the responsibility of the plugin to fetch the needed data from the event with event.get() or event.sprintf() and is not done on your behalf internally
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.