Hi,
I am using XPATH in XML filter to extract some values.
I am getting three arrays. Something on these lines:
ArrayOfId = ["SamplingRate","Humidity","DateOfCalibration","ProductFamily"]
ArrayOfType = ["Number","Number","Date","Text"]
ArrayOfValue = ["23","21","27/08/2021","Hunira"]
I am using Ruby to combine these into a single event. I am able to get something like this:
"SamplingRate" => "23"
"Humidity" => "21"
"DateOfCalibration" => "27/08/2021"
"ProductFamily" => "Hunira"
Code:
ruby
{
code => "idarray = event.get('[ArrayOfId]')
valuearray = event.get('[ArrayOfValue]')
idarray.zip(valuearray).each { |key, value| event.set(key, value); }"
}
I am stuck at how to use the information in the ArrayOfType
to make proper conversions in logstash. For example I will like to map every Number as float. I am ok to do this in Ruby filter level.
Any ideas?