Splunk Search

Fill Null not working as expected

willadams
Contributor

I have a CSV that I am monitoring.  The CSV has lots of fields and my extraction works appropriately.  What I have noticed is that depending on the item in the CSV the field either has a value or not.  I have noticed that this appears to be common with fields all prefixed with the same term.  An example of the data set

 

comp_domain

comp_cputype

comp_department

last_logon_date

Enabled

Name

 

If I run the following SPL then for all the fields EXCEPT comp_*, SPLUNK will populate it with my value

 

index=foo 
| fillnull value="Nothing"

 

 

So using the above fields

 

fieldvalue
comp_domain 
comp_cputype 
comp_department 
last_logon_dateNothing
EnabledNothing
NameNothing

 

If I run an eval to look for null for one of the value (e.g. comp_domain) I get the same result

 

index=foo
| eval job=if(isnull(comp_domain),"Nothing here",comp_domain)

 

 

fieldvalue
comp_domain 

 

The same will happen for any field with "comp_" prefixed but works fine for fields that don't have a prefix.  

Labels (1)
Tags (2)
0 Karma

yeahnah
Motivator

Hi @willadams 

Go back to the source csv file, I suspect that it must have a whitespace value or something so Splunk does not consider it a true null value, as the eval test proves in your example.

Here's a run anywhere example of what I mean...

 

| makeresults 
| eval test=1, blank=" " , empty=""
| foreach blank empty [ eval <<FIELD>>_size=len(<<FIELD>>) ]
| foreach blank empty [ eval <<FIELD>>=if(isnull('<<FIELD>>'), "NULL", "NOT NULL") ]
| eval empty=null()
| appendpipe [
     eval test=2
   | foreach blank empty [ eval <<FIELD>>_size=len(<<FIELD>>) ]
   | foreach blank empty [ eval <<FIELD>>=if(isnull('<<FIELD>>'), "NULL", "NOT NULL") ]
]

 

Results

 
  _time blank blank_size empty empty_size test
12020-09-01 17:24:52NOT NULL1 01
22020-09-01 17:24:52NOT NULL8NULL 2


Hope this helps.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Monitoring AI Agents with Splunk Observability Cloud

Let’s say I’m running a travel planning AI app in production. A user asks for three concise hotel options in ...

[Puzzles] Solve, Learn, Repeat: Tiling

This puzzle (first published here) is based on finding groups of tessellated tiles (inspired by floor tiles I ...

SOK it to Me: Top 3 Benefits of Using Splunk Operator on Kubernetes that’ll Make ...

    Thursday, July 9, 2026  |  11:00AM–12:00PM PDT Duration: 1 hour (includes Q&A) Managing can feel like a ...