Splunk Search

How to combine multiple events from two indexes in Splunk

welcome
Engager

1st query:  index="A" event_tag="event1" build_number=1 job_name=job1 type=completed  

2nd query:  index="B" event_tag="event2" build_number=1 job_name=job1

We have some events in indexA and some events in indexB ,how to combine these using common fileds are build_number and job_name.

What will the query

 

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

There are a few ways to combine searches, but the preferred way uses the general form:

(<<query 1>>) OR (<<query 2>>)
| stats values(*) as * by <<common fields>>
---
If this reply helps you, Karma would be appreciated.

welcome
Engager

It is showing statistical information but not merging ,I want events from indexA and indexB together as single event .What will be the query and how can I know merging was happened .
I don't want table or statistics format 

 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The join command should produce the format you seek, but you'll be unhappy with the performance.  That's why the previous method I suggested is preferred.

<<query 1>>
| join <<common fields>> [ <<query 2>> ]

 

---
If this reply helps you, Karma would be appreciated.
0 Karma

welcome
Engager

Join command is ok ,but how can know these two index events are combined,how can I see the combined data.Please give the proper answer

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The indexed events are not combined.  Indexed data is never changed so the events will forever remain separated.  All we can do is correlate data from the indexes and display it in an appropriate format.  You can, however, write the correlated data to a summary index using the collect command then fetch the events in the summary index to see a combined event.

---
If this reply helps you, Karma would be appreciated.
0 Karma

welcome
Engager

But we have some events of job in indexA and some events of job in indexB ,suppose if we want to create a table all events of same job,how can we do that 

0 Karma

richgalloway
SplunkTrust
SplunkTrust

My first answer said how to create a table with events of the same job from both indexes, but then you said you don't want a table.

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

Celebrating Fast Lane: 2025 Authorized Learning Partner of the Year

At .conf25, Splunk proudly recognized Fast Lane as the 2025 Authorized Learning Partner of the Year. This ...

Tech Talk Recap | Mastering Threat Hunting

Mastering Threat HuntingDive into the world of threat hunting, exploring the key differences between ...

Observability for AI Applications: Troubleshooting Latency

If you’re working with proprietary company data, you’re probably going to have a locally hosted LLM or many ...