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!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...