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!

Index This | What did the zero say to the eight?

June 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

Splunk Observability Cloud's AI Assistant in Action Series: Onboarding New Hires & ...

This is the fifth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how to ...

Now Playing: Splunk Education Summer Learning Premieres

It’s premiere season, and Splunk Education is rolling out new releases you won’t want to miss. Whether you’re ...