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!

Splunk Mobile: Your Brand-New Home Screen

Meet Your New Mobile Hub  Hello Splunk Community!  Staying connected to your data—no matter where you are—is ...

Introducing Value Insights (Beta): Understand the Business Impact your organization ...

Real progress on your strategic priorities starts with knowing the business outcomes your teams are delivering ...

Enterprise Security (ES) Essentials 8.3 is Now GA — Smarter Detections, Faster ...

As of today, Enterprise Security (ES) Essentials 8.3 is now generally available, helping SOC teams simplify ...