Splunk Search

stats min(count) not 0 if value never occurs

viggor
Path Finder

If I have the following query

foo
| timechart span=60s  count 
| stats min(count) as minCntFoo

but foo never occurs, is there a way of setting minCntFoo=0 instead of now, where I get "No results found."?

0 Karma

cmerriman
Super Champion

try this:

foo
 | timechart span=60s  count 
 | stats min(count) as minCntFoo
| appendpipe [ stats count | eval minCntFoo=0 | where count==0 |table minCntFoo]

the appendpipe stats command will count the number of events that come back and only bring back results if there are 0 events from the base query.

Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...