Splunk Search

Splunk query to aggregate hourly event count per hosts

swinod
New Member

How can i get the hourly count of events per host (events in the past 24 hours). For e.g.
|metadata type=hosts index=* , gives the totalcount. Is there a way to aggregate this number by events in an hour. I would like to have one row for every host and the column header to be more like -
host, totalcount, Hour(1), Hour(2), Hour (3), Hour (4).....Hour (24), where the aggregate of Hour(1) to Hour (24) adds to the totalcount.

Tags (1)
0 Karma

renjith_nair
Legend

@swinod ,

Try this and test

|tstats count where index=*  by _time,host span=1h |eval time=strftime(_time,"%H")
|chart first(count) over host by time| addtotals fieldname=Total row=t

You may adjust the index part to get the count from specific index

---
What goes around comes around. If it helps, hit it with Karma 🙂
0 Karma
Get Updates on the Splunk Community!

How to Monitor Google Kubernetes Engine (GKE)

We’ve looked at how to integrate Kubernetes environments with Splunk Observability Cloud, but what about ...

Index This | How can you make 45 using only 4?

October 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

Splunk Education Goes to Washington | Splunk GovSummit 2024

If you’re in the Washington, D.C. area, this is your opportunity to take your career and Splunk skills to the ...