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!

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...