Splunk Search

How to use append on stats table to show count past 5 minutes?

brianMiller94
Engager

Hello,

I am trying to show the last 5 minute count with a larger time period spark chart.

index="iis"
|stats sparkline count by host
|append [search index="iis" earliest=-5m latest=now 
|stats count by host as "last_5"]
|rename host as "Web Server"
|rename sparkline as "Count Over Time"
|rename "last_5" as "Count Last 5 Minutes"
|table "Web Server", "Count Over Time", "Count Last 5 Minutes"

The last column is blank but the subsearch returns the expected data.

0 Karma
1 Solution

somesoni2
SplunkTrust
SplunkTrust

Give this a try

index="iis"
| eval last5m=if(_time>=relative_time(now(),"-5m"),1,0)
 |stats sparkline as  "Count Over Time" sum(last5m) as "Count Last 5 Minutes" by host
 |rename host as "Web Server"
 |table "Web Server", "Count Over Time", "Count Last 5 Minutes"

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

Give this a try

index="iis"
| eval last5m=if(_time>=relative_time(now(),"-5m"),1,0)
 |stats sparkline as  "Count Over Time" sum(last5m) as "Count Last 5 Minutes" by host
 |rename host as "Web Server"
 |table "Web Server", "Count Over Time", "Count Last 5 Minutes"

brianMiller94
Engager

Worked great, thank you!

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...