Splunk Search

Compare search field to multiple lookup fields

user2020dy
Path Finder

I have field src_ip in my data.

 

My lookup fields: ip1,  ip2,  ip3, ip4,  user

 

What I want is to find matching pairs in  src_ip and ip1,  ip2,  ip3, ip4 and OUTPUT the name of user, who this src_ip belongs to.

 

How can I do this?

Labels (5)
0 Karma
1 Solution

richgalloway
SplunkTrust
SplunkTrust

You'll need to use multiple lookups to do that.

 

... | lookup ip1 as src_ip output user
| lookup ip2 as src_ip outputnew user
| lookup ip3 as src_ip outputnew user
| lookup ip4 as src_ip outputnew user
...

 

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

View solution in original post

0 Karma

richgalloway
SplunkTrust
SplunkTrust

You'll need to use multiple lookups to do that.

 

... | lookup ip1 as src_ip output user
| lookup ip2 as src_ip outputnew user
| lookup ip3 as src_ip outputnew user
| lookup ip4 as src_ip outputnew user
...

 

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

user2020dy
Path Finder

I know this works, but can`t I do this within one command?

It is stated in documentation that multiple fields can be included in the list.

0 Karma

richgalloway
SplunkTrust
SplunkTrust

Yes, the lookup command supports multiple fields, but all of the fields are ANDd during the lookup.  The only way to do an OR is via multiple lookups.

---
If this reply helps you, Karma would be appreciated.
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...