Splunk Search

if .csv file is empty how to get correct result in search

Mike6960
Path Finder

For one of my dashboards I am working with .csv files which are generated every day. these contain certain failures from different processes. When those are solved they will not appear the next day. So, if there are no failures at any one day the file will be empty. Splunk cannot index files which contain only headers.
I want to show a single value withe trendline to show the increase/decrease of failures. I f the file is empty the search shows the number of the last day where there were failures. How can i solve this?

Tags (1)
0 Karma

MuS
SplunkTrust
SplunkTrust

Hi Mike6960,

read this answer https://answers.splunk.com/answers/176466/how-to-use-eval-if-there-is-no-result-from-the-bas-1.html to learn how you can handle empty search results.

Update:

take a look at this run everywhere example, yes it uses makeresults but only to create fake events 😉

| makeresults `comment("Let build some fake events ...")`
| eval _raw="company,tesco|count,100|count,200|count,0|count,300" 
| extract pairdelim="|", kvdelim=",", mv_add=true, limit=0 
| mvexpand count 
| table _time company count `comment("This is where the fun starts ...")`
| streamstats current=f last(count) AS l_count by company 
| eval show_on_no_results=case(count="0", l_count,count!="0", null())

The important SPL command is the streamstats which will take the last known number and then you can use this last number and display it when the actual result is 0 😉

Hope this helps ...

cheers, MuS

0 Karma

Mike6960
Path Finder

@MuS, thanks for your response. Not really what I am looking for I think. Or maybe I don't understand the answer, I guess I have to look for something like makeresults or something

0 Karma

MuS
SplunkTrust
SplunkTrust

Hi Mike6960, sure you can use the answer as staring point. Just hold some minutes and I will be back with an example 😉

0 Karma

MuS
SplunkTrust
SplunkTrust

Update ping ...

0 Karma
Get Updates on the Splunk Community!

Data Management Digest – December 2025

Welcome to the December edition of Data Management Digest! As we continue our journey of data innovation, the ...

Index This | What is broken 80% of the time by February?

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

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...