Splunk Search

How to edit my search to find the average and max duration per event?

skhprabu
New Member

I have these results from search result |table event_name duration

event_name    duration
task1                 2
task2                 3
task3                 8
task1                 3
task2                 6
task4                 5

I want to average and max duration of each event

something like this

event_name avgDuration maxDuration
task1          2.5          3
task2          4.5          6
task3          8            8
task3          5            5
0 Karma

aaraneta_splunk
Splunk Employee
Splunk Employee

@skhprabu - Did the answer provided by richgalloway help provide a working solution to your question? If yes, please don't forget to resolve this post by clicking "Accept". If no, please leave a comment with more feedback. Thanks!

0 Karma

richgalloway
SplunkTrust
SplunkTrust

It would help to see your full search, but this may help you.

your search | stats avg(duration) as avgDuration max(duration) as maxDuration by event_name | table event_name avgDuration maxDuration
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...