Splunk Enterprise

How to compare a field from different index and display multiple fields from both indexes?

JustAnotherGuy
Observer

I want to compare one field between two index. For example Field A.

index A: Field A, Field B, Field C

index B: Field A, Field D, Field E

Now I want to grab all the data in tabular format as follows:

Field A Field B Field C Field D Field E

 

I tried using join function but the limitation of the join function is that the Field D and Field E are not captured in the search and displayed due to inner join. 

Is there something with full join functionality and displaying the results as displayed when using join function? 

 

My attempt:

index = A sourcetype = A Field H = something | table Field A Field B Field C 
| join Field A [ search index = B sourcetype= B | table Field D Field E ]

Desired result:

Field A Field B Field C Field D Field E

0 Karma

JustAnotherGuy
Observer

Thanks for your prompt response but there seems to be issue with this query:

index = A sourcetype=A FieldH=something 
The above search gives 50 unique values of Field A

index = B sourcetype = B 

This search gives 100 unique values of Field A

 

So using stats by Field A will give those 50 unnecessary values as well. Also, this search will give output for different index in different rows in the table. I want to match Field A in both index and in tabular format want to have everything in one row grouped by Field A.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
(index=A sourcetype=A FieldH=something) OR (index=B sourcetype=B)
| eval inA=if(index=A,1,0)
| stats values(inA) as inA values(FieldB) as FieldB values(FieldC) as FieldC values(FieldD) as FieldD values(FieldE) as FieldE by FieldA
| where inA=1
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Don't use join.  There was a good talk about this at .conf20 this week.  Check it out at conf.splunk.com when it's available.

Use stats to join separate searches.

(index=A sourcetype=A FieldH=something) OR (index=B sourcetype=B)
| stats values(*) as * by FieldA

 

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Fall Into Learning with New Splunk Education Courses

Every month, Splunk Education releases new courses to help you branch out, strengthen your data science roots, ...

Super Optimize your Splunk Stats Searches: Unlocking the Power of tstats, TERM, and ...

By Martin Hettervik, Senior Consultant and Team Leader at Accelerate at Iver, Splunk MVPThe stats command is ...

How Splunk Observability Cloud Prevented a Major Payment Crisis in Minutes

Your bank's payment processing system is humming along during a busy afternoon, handling millions in hourly ...