Splunk Search

searching across multiple indexes with lookups

caseysutherland
Engager

we have two indexes with some overlap in fields. specifically IP addresses. what I would like to is do an initial search dedup all the dest_ips then in the same search string use the deduped list of IPs as the filter on the second index. Is this possible? I would think some type of lookup table is the way to go.

Tags (1)
0 Karma

harsmarvania57
Ultra Champion

Hi,

Can you please try something like this?

index=<index 1> [search index=<index 2> | dedup dest_ip| return dest_ip]

caseysutherland
Engager

does this return all the events in index one that have a dest_ip that exists in the list of dest_ips returned from index 2?

0 Karma

harsmarvania57
Ultra Champion

This will display dest_ip which are in Index 2 and then AND with index 1 dest_ip

So this query works like this index= index 1 AND dest_IP from Index 2

0 Karma

elliotproebstel
Champion

It depends on the size of the result set and the frequency with which you'll run this. If you want to save the results of that first deduped query to use over and over, the lookup file would be a good way to go:

index=first_index
| stats values(dest_ip) AS dest_ip
| outputlookup ip_list

And then to use it in your subsequent searches:

index=second_index 
[ | inputlookup ip_list 
  | stats values(dest_ip) AS dest_ip 
  | format ]

If it's just an ad-hoc thing you want to run once, you are likely fine with a single subsearch:

index=second_index
[ search index=first_index
  | stats values(dest_ip) AS dest_ip
  | format ]
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...