Reporting

Splunk Host Metrics Report

scout29
Explorer

I am trying to create a search that will generate a report showing host by event count in the last hour and also the average 7 day hourly event count per host.

So far i have the below search that shows host by event count over the last hour - but i am struggling to get a column added showing the weekly hourly average?

 

| tstats count where index=* by host, index, sourcetype | addtotals | sort -Total | fields - Total | rename count as events_latest_hour

 

Any help on how i get a column added showing the 7 day hourly average for event count ?

Labels (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @scout29,

let me understand: you want:

number of events by host in the last hour and the hourly average in the last seven days, is it correct?

please try this:

| tstats count WHERE index=* BY host _time span=1h
| stats 
   avg(count) AS Average
   values(eval(if(_time>=now()-3600,count,0))) AS "Last hour"
   BY host

Ciao.

Giuseppe

View solution in original post

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @scout29,

let me understand: you want:

number of events by host in the last hour and the hourly average in the last seven days, is it correct?

please try this:

| tstats count WHERE index=* BY host _time span=1h
| stats 
   avg(count) AS Average
   values(eval(if(_time>=now()-3600,count,0))) AS "Last hour"
   BY host

Ciao.

Giuseppe

0 Karma

scout29
Explorer

@gcusello  - Thanks! How could i modify this to include one more column showing the percent variance between the average count and latest hour count?

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @scout29,

use an eval command at the end of the search.

Ciao.

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...