Splunk Search

Combine 2 searches with 2nd search dependent on first

worldexplorer81
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:
index=batch
| where jobName="test_job1" AND statusText in ("FAILURE", "SUCCESS")

Second query:
index=batch
| 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!

Optimize Cloud Monitoring

  TECH TALKS Optimize Cloud Monitoring Tuesday, August 13, 2024  |  11:00AM–12:00PM PST   Register to ...

What's New in Splunk Cloud Platform 9.2.2403?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.2.2403! Analysts can ...

Stay Connected: Your Guide to July and August Tech Talks, Office Hours, and Webinars!

Dive into our sizzling summer lineup for July and August Community Office Hours and Tech Talks. Scroll down to ...