Splunk Search

help me with join condition

sravankaripe
Communicator

alt text

i have two indexes i have Sid common in both

i want to display Sid and Did in a table.
Please help me with join condtion.

Tags (2)
0 Karma
1 Solution

jkat54
SplunkTrust
SplunkTrust
index=index2 sid=* | join type=left sid [search index=index1 sid=* | fields sid ] | table sid did

This assumes index2 has sid & did, and index1 has just sid

Basically mirror your image and follow the docs: http://docs.splunk.com/Documentation/SplunkCloud/6.5.1612/SearchReference/Join

View solution in original post

somesoni2
SplunkTrust
SplunkTrust

How about this? (will keep events with sid common and sid only in index=B, the right outer join)

index=A OR index=B | stats value(did) as did values(index) as indexes by sid | where isnotnull(mvfind(indexes,"B"))

somesoni2
SplunkTrust
SplunkTrust

Is there a common field between those two indexes? If I understand correctly you're trying to get what a SQL right outer join will give, is it correct?

0 Karma

sravankaripe
Communicator

Sid is a common field.
Yes, it is similar like SQL Right join .

0 Karma

jkat54
SplunkTrust
SplunkTrust
index=index2 sid=* | join type=left sid [search index=index1 sid=* | fields sid ] | table sid did

This assumes index2 has sid & did, and index1 has just sid

Basically mirror your image and follow the docs: http://docs.splunk.com/Documentation/SplunkCloud/6.5.1612/SearchReference/Join

sravankaripe
Communicator

index=index2 sid=* | join type=left sid [search index=index1 sid=* ] | table sid did

this is working

0 Karma
Get Updates on the Splunk Community!

What's new in Splunk Cloud Platform 9.1.2312?

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

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...

Let’s Get You Certified – Vegas-Style at .conf24

Are you ready to level up your Splunk game? Then, let’s get you certified live at .conf24 – our annual user ...