Splunk Search

Matching records from 2 different indexes with a look up

sherins
New Member

I have 2 indexes and need to get only a records of field that exists in both indexes.

One of the index has to filter events based on a look up file and then the resultant set should match with the other index for output.
Need the splunk query for same.

Tags (3)
0 Karma

to4kawa
Ultra Champion
index=firstindex OR index=secondindex   
[|inputlookup mylookup.csv field1]
|stats dc(index) as flag by field1
|where flag>1
|table field1

Hi, @sherins
this is assuming field1 is the common field among indexes.
how about this?

...everybody wants to join the searches...

0 Karma

ashajambagi
Communicator
 index=secondindex
 | join field1 
     [ search index=firstindex
     |lookup mylookup.csv field1 as field1
     | table field1] ]
0 Karma

jawaharas
Motivator

Assuming field1 is the common field among indexes and lookup file, try below query.

index=index-1
| join field1 
    [ search index=index-2 
    | table field1 
    | search 
        [| inputlookup mylookup.csv 
        | table field1] ]
0 Karma
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 ...