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!

Exciting News: The AppDynamics Community Joins Splunk!

Hello Splunkers,   I’d like to introduce myself—I’m Ryan, the former AppDynamics Community Manager, and I’m ...

The All New Performance Insights for Splunk

Splunk gives you amazing tools to analyze system data and make business-critical decisions, react to issues, ...

Good Sourcetype Naming

When it comes to getting data in, one of the earliest decisions made is what to use as a sourcetype. Often, ...