Splunk Search

How to search the count and average count of events per hour?

shellnight
Explorer

Hello

Please can you provide a search for getting the number of events per hour and average count per hour?

Tags (1)
0 Karma
1 Solution

lloydd518
Path Finder

Hi

As per this question http://answers.splunk.com/answers/90569/event-count-per-user-per-hour.html

sourcetype=your_sourcetype earliest=-48h latest=-24h | bucket _time span=1h | stats count by _time | sort - count

This will count the events per hour between 48 hours ago to 24 hours ago... (change this as you see fit or remove earliest and latest)

If you want to average all of those results, you would add the stats avg(count) at the end of the search:

sourcetype=your_sourcetype earliest=-48h latest=-24h | bucket _time span=1h | stats count by _time | stats avg(count)

This will average out the number of events per hour...

If you have a specific event you are looking for, that would go at the beginning:

sourcetype=your_sourcetype earliest=-48h latest=-24h   some_thing_that_I'm_trying_to_match    | bucket _time span=1h | stats count by _time | sort - count

sourcetype=your_sourcetype earliest=-48h latest=-24h   some_thing_that_I'm_trying_to_match    | bucket _time span=1h | stats count by _time | stats avg(count)

View solution in original post

lloydd518
Path Finder

Hi

As per this question http://answers.splunk.com/answers/90569/event-count-per-user-per-hour.html

sourcetype=your_sourcetype earliest=-48h latest=-24h | bucket _time span=1h | stats count by _time | sort - count

This will count the events per hour between 48 hours ago to 24 hours ago... (change this as you see fit or remove earliest and latest)

If you want to average all of those results, you would add the stats avg(count) at the end of the search:

sourcetype=your_sourcetype earliest=-48h latest=-24h | bucket _time span=1h | stats count by _time | stats avg(count)

This will average out the number of events per hour...

If you have a specific event you are looking for, that would go at the beginning:

sourcetype=your_sourcetype earliest=-48h latest=-24h   some_thing_that_I'm_trying_to_match    | bucket _time span=1h | stats count by _time | sort - count

sourcetype=your_sourcetype earliest=-48h latest=-24h   some_thing_that_I'm_trying_to_match    | bucket _time span=1h | stats count by _time | stats avg(count)

shellnight
Explorer

THANK YOU VERY MUCH !!!

0 Karma
Get Updates on the Splunk Community!

Buttercup Games: Further Dashboarding Techniques (Part 5)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...

Customers Increasingly Choose Splunk for Observability

For the second year in a row, Splunk was recognized as a Leader in the 2024 Gartner® Magic Quadrant™ for ...

Bridging the Gap: Splunk Helps Students Move from Classroom to Career

The Splunk Community is a powerful network of users, educators, and organizations working together to tackle ...