Splunk Search

Alternative to Joins

vikasreddy
Explorer

I have 2 indexes say (A1 and A2) I have Fields a,b,c,d in index A1, In the index A2 I have fields b,e,f,g . I need to pull the data of the e,f,g fields from the A2 index if "b" values present in the both the index .I don't want to use the joins. Any way we can implement this ?.
Here is the sample search , what I have written but no luck ..
(index=A1 fields a,b,c,d) OR (index=A2 fields b,e,f,g)
| eval E=if(b==b,e,null())
| eval F=if(b==b,f,null())
| eval G=if(b==b,g,null())
| table E,F,G,b

Any help would be great ..Thanks 🙂

0 Karma

MuS
SplunkTrust
SplunkTrust
0 Karma

kamlesh_vaghela
SplunkTrust
SplunkTrust

Can you please try this?
(index=A1) OR (index=A2) | stats values(a) as a values(c) as c values(d) as d values(e) as e values(f) as f values(g) as g by b | where ( isnotnul(e) OR isnotnul(f) OR isnotnul(g) )

0 Karma

somesoni2
SplunkTrust
SplunkTrust

Try like this. This will give results for values of field b which is present in both indexes

(index=A1) OR (index=A2)
| fields a,b,c,d,e,f,g
| stats values(a) as a values(c) as c values(d) as d values(e) as e values(f) as f values(g) as g dc(index) as indexes by b
| where indexes=2

cmerriman
Super Champion

try something like this:

(index=A1 a=* b=* c=* d=*) OR (index=A2 b=* e=* f=* g=*)
|stats values(e) as e values(f) as f values(g) as g by b

it will give you the values of e, f, and g for every b value

richgalloway
SplunkTrust
SplunkTrust

The stats command can replace join.

(index=A1 a=* b=* c=* d=*) OR (index=A2 b=* e=* f=* g=*) | stats values(c) as c values(d) as d values(e) as e values(f) as f values(g) as g by b | table e f g b
---
If this reply helps you, Karma would be appreciated.
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...