Splunk Search

Filtering out NULL values after stats not working

tumapath
New Member

I am trying to filter out null values from the result of stats. Query looks like below.

 

 

index=someindex* some
   ((somefield1=value1 AND somefield2="value2") 
     AND (somefield1=value3  
          OR (somefield2=value4  
               AND somefield1=value5
              )
         )
   )
   OR (somefield1=value6)
| eval someeval=...
| replace "some*" with "SOME" in somefield1
| bucket _time span=1d as daytime
| stats max(eval(if(somefield1=value1,_time,null()))) as val1_time
        min(eval(if(somefield1=value2,_time,null()))) as val2_time
        min(eval(if(somefield1=value3 ,_time,null()))) as val3_time
        by somefield3 somefield4 
| eval recovered_time=if(isNotNull(val2_time),val2_time,val3_time)
| where isNotNull(val1_time)

 

 

But this query returns result with null or empty val1_time also.

What could be the issue in this query? I further pass the result of this query to another stats query.  But I am stuck here.

Labels (2)
0 Karma

tumapath
New Member

Adding this line in the end does the magic. 

| where isNotNull(val1_time) AND val1_time != ""

 

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Accelerating Observability as Code with the Splunk AI Assistant

We’ve seen in previous posts what Observability as Code (OaC) is and how it’s now essential for managing ...