Splunk Search

Combine 2 searches with 2nd search dependent on first

Path Finder

I am trying to combine 2 searches into one. However, the results for the 2nd search should only return if there are results in the first one.

If no results in the first query, then nothing should be returned. If there are results from the first one, then display the returns from the 2nd search

First query:
| where jobName="test_job1" AND statusText in ("FAILURE", "SUCCESS")

Second query:
| where like(jobName,"test%") AND statusText="FAILURE" | stats earliest(statusText) as First_Failure, earliest(timestamp) as First_Failure_Time by jobName, machine
| join jobName
[search index=batch | where like(jobName,"test%") | stats latest(statusText) as Latest_Status, latest(timestamp) as Last_Updated_time by jobName]
| sort by Last_Updated_time desc

Any help would be appreciated. Thanks

Tags (1)
0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...