One method could be to use the convert command to change the field from a duration into to seconds, then average with some form of stats, and if necessary use the tostring function in an eval to change back to duration format.
... | convert dur2sec(field) | stats avg(field) as field | eval field=tostring(round(field),"duration")
Now with any solution there are some assumptions of your data, with this convert method, it assumes that
If your data doesn't conform to this, then you could craft your own regular expression and use rex command to pull out the pieces and use an eval to combine into seconds:
... | rex field=field "^(?<dur_h>\d+):(?<dur_m>\d+):(?<dur_s>\d+(?:\.\d+)?)$" | eval dur = (dur_h*60 + dur_m)*60 + dur_s | stats avg(dur) as field
One method could be to use the convert command to change the field from a duration into to seconds, then average with some form of stats, and if necessary use the tostring function in an eval to change back to duration format.
... | convert dur2sec(field) | stats avg(field) as field | eval field=tostring(round(field),"duration")
Now with any solution there are some assumptions of your data, with this convert method, it assumes that
If your data doesn't conform to this, then you could craft your own regular expression and use rex command to pull out the pieces and use an eval to combine into seconds:
... | rex field=field "^(?<dur_h>\d+):(?<dur_m>\d+):(?<dur_s>\d+(?:\.\d+)?)$" | eval dur = (dur_h*60 + dur_m)*60 + dur_s | stats avg(dur) as field
Thanks a lot @acharlieh ♦ !
Worked perfectly!
Just tryin' now to get the difference from the last head 1 event duration to the average duration.
With the average and the last event I shall get the deviation to generate a red, yellow or green status.
Thanks!
May be do an eval and convert them to total seconds into a new field.. and do average on the new field.
What function could I use to convert em with an eval? I mean, I dont have the full date...