I am doing calculation in Ruby but the fields are empty in Kibana.
The ruby code:
event.set('BusinessTimeUnavailabilityinSeconds', ((event.get('BusinessUnavailabilityHours').to_i * 3600 ) + (event.get('BusinessUnavailabilityMinutes').to_i * 60) + event.get('BusinessUnavailabilitySeconds').to_i))
event.set('NonPrimeTimeUnavailabilityinSeconds', (event.get('TotalTimeUnavailabilityinSeconds') - event.get('BusinessTimeUnavailabilityinSeconds')))
event.set('BusinessTimeUnavailabilityPercentage' , (event.get('BusinessTimeUnavailabilityinSeconds').to_f).div(197100))
event.set('NonPrimeTimeUnavailabilityPercentage' , (event.get('NonPrimeTimeUnavailabilityinSeconds').to_f).div(118260))
After, I am converting:
mutate {
convert => { "NonPrimeTimeUnavailabilityinSeconds" => "integer"
"TotalTimeUnavailabilityinSeconds" => "integer"
"BusinessTimeUnavailabilityinSeconds" => "integer"
"BusinessTimeUnavailabilityPercentage" => "float"
"NonPrimeTimeUnavailabilityPercentage" => "float"
}
}
The result in Kibana:
|# BusinessTimeUnavailabilityPercentage| |0|
|---|---|---|
|# BusinessTimeUnavailabilityinSeconds| |15,300|
As as, I would expect to get : 0.7762
What am I missing here?
Regards,
Sharon.