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!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...