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!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...