Hello.
This is the code I have.
mutate {convert => ["Average Time of Execution", "float"]}
mutate {convert => ["Average Time of Execution - Last Hour", "float"]}
ruby {
code => "event['last Hour Perc'] = event['Average Time of Execution'] / event['Average Time of Execution - Last Hour']"
}
But i'm getting the following error when I execute.
Ruby exception occurred: undefined method '/' for ...
How do I solve this? Thank you.
Please show the full error message. Are you sure the Average Time of Execution field exists for all events?
The problem is that the field is an array and not a singular float value.
I'm sorry, but how do I access that value?
event['Average Time of Execution'][0] accesses the first (and in this case only) element of the array. Depending on how it ends up as an array there might be a way to it being an array.
Totally worked. You're the man
Cheers