Splunk Search

Join is not returning events if subsearch is empty. How to fix it

denissotoacc
Path Finder

I have an Index called myindex:

NAMEAGECITYCOUNTRYLEGAL AGE
Denis17LondonUKNO
Denis18  YES
Maria17RosarioArgentinaNO
Maria18  YES
Nani11ParisFranceNO

 

This is a basic example. The case is when LEGAL AGE=NO, there are several more fields available than when LEGAL AGE=YES. Notice that when LEGAL AGE=YES the field "CITY" and "COUNTRY" didn't exists at all.

What I need to get are all the people of this index with all the information EVEN if they are not in LEGAL AGE.

I use a join for this:

 

index=myindex "LEGAL AGE"=NO
| join NAME
        [ search index=myindex "LEGAL AGE"=YES ]

 


The problem is that it is working only if the subsearch returns something. In this example, it will work for Denis and Maria, but not for Nani. How can I make it works even if subsearch is returning nothing?

Labels (2)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

I think the problem is the join command defaults to an inner join.  Try join type=outer NAME ...

---
If this reply helps you, Karma would be appreciated.

View solution in original post

richgalloway
SplunkTrust
SplunkTrust

I think the problem is the join command defaults to an inner join.  Try join type=outer NAME ...

---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...