Splunk Search

Getting the time that maximum count occurs every hour

klodian90
New Member

I have a search that finds the maximum number of events that occur in a single second on any given hour during the day using this

.. | bin _time span=1s | stats count by _time, name | bin _time span=1h | stats max(count) as mcount by _time, service | ...

this gives me a table of values that look like the following
Hour | Maximum
1 AM | 900
2 AM | 323
........ | .....

Instead I also want a third column which has the time that that event occurred as follows.

1 AM | 900 | September 1 2016, 12:34:06
2 AM | 323 | September 5 2016, 11:07:01
........ | .....

Any help would be appreciated.

0 Karma

somesoni2
Revered Legend

Try like this

.. | bin _time span=1s | stats count by _time, name | eval time=_time | bin _time span=1h | eventstats max(count) as mcount by _time, service | where mcount=count |eval time=strftime(time,"%+")
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...