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!

Super Optimize your Splunk Stats Searches: Unlocking the Power of tstats, TERM, and ...

By Martin Hettervik, Senior Consultant and Team Leader at Accelerate at Iver, Splunk MVPThe stats command is ...

How Splunk Observability Cloud Prevented a Major Payment Crisis in Minutes

Your bank's payment processing system is humming along during a busy afternoon, handling millions in hourly ...

Index This | What’s a riddle wrapped in an enigma?

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