Splunk Search

Splunk subsearch noresult

pdash
Path Finder

Am trying to run a query where subsearch might return no results on some days. In such case i am trying to assign 0 values to calculate ratio, but its not returning any results.

index=main sourcetype="abc" 
| eval date=strftime(_time, "%x") 
| stats dc(uuid) as countA by date   
| join _time  [ search index=main sourcetype="abc" | eval date=strftime(_time, "%x") | search "error" | stats dc(uuid) as countB by date]
| eval Ratio=(countA/(countA+countB)) 

I have tried appending fillnull at the end of subsearch but it returns noresults.

Tags (1)
0 Karma

pdash
Path Finder

got it:

index=main sourcetype="abc"
| eval date=strftime(_time, "%x")
| stats dc(uuid) as countA by date

| join _time [ search index=main sourcetype="abc" | eval date=strftime(_time, "%x") | search "error" | stats dc(uuid) as countB by date | appendpipe [ stats count | eval countB=0 | where count==0 | fields - count ] ]
| eval Ratio=(countA/(countA+countB))

0 Karma
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...