Splunk Search

show value in case of no results found

avivn
Explorer

hello,
I'm trying to do a stats count command and to show "0" (for single value chart) instead of N/A in case the query gets no results found.
i tried fillnull but nothing happened.

thank you

Tags (1)
0 Karma

sundareshr
Legend

Try this

base search returning single value | append [| makeresults | eval samefieldasreturnedbybasesearch=0] | head 1

richgalloway
SplunkTrust
SplunkTrust

If there are no results from your query there is nothing for fillnull to fill.

Try this, replacing processCount with the field from your stats command:

your base search | appendpipe [ stats count | eval processCount=0 | where count==0 | fields - count ]
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...