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
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!

SOC4Kafka - New Kafka Connector Powered by OpenTelemetry

The new SOC4Kafka connector, built on OpenTelemetry, enables the collection of Kafka messages and forwards ...

Event Series: Level up your SOC: Advancing with Splunk Enterprise Security

AI has fundamentally raised the stakes for security operations, and this three-part series is your guide to ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...