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
Legend
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
Revered Legend

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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

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 GA in US-AWS!

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