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!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...