Splunk Search

way to run mulitple fields against a lookup, with OR statement

spicy
Path Finder

I am trying to run two fields against one column using a lookup. 

This SPL does not work, but conveys what I am trying to do.

| lookup blacklist.csv ioc_list AS (src_ip OR dest_ip) OUTPUTNEW ioc_list,  feedback

 

Is there a way I can do something like the above command without running two separate lookup commands?

Labels (1)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

@spicy 

You can use a multivalue field as the lookup, i.e.

| eval ioc_list_mv=mvappend(src_ip, dest_ip)
| lookup blacklist.csv ioc_list AS ioc_list_mv OUTPUT ioc_list as found_ioc_list,  feedback

Not sure your intentions with the OUTPUTNEW use case. If both src and dest ips exist in the lookup, then the lookup will only return the first value of the multivalue field it finds.

How many ips do you have in the lookup and have you found a performance issue with the lookup in general? You can setup a lookup definition that does batch requests if performance is an issue. You could also use a KV store with accelerated fields of the IP address which are pretty quick.

 

View solution in original post

bowesmana
SplunkTrust
SplunkTrust

@spicy 

You can use a multivalue field as the lookup, i.e.

| eval ioc_list_mv=mvappend(src_ip, dest_ip)
| lookup blacklist.csv ioc_list AS ioc_list_mv OUTPUT ioc_list as found_ioc_list,  feedback

Not sure your intentions with the OUTPUTNEW use case. If both src and dest ips exist in the lookup, then the lookup will only return the first value of the multivalue field it finds.

How many ips do you have in the lookup and have you found a performance issue with the lookup in general? You can setup a lookup definition that does batch requests if performance is an issue. You could also use a KV store with accelerated fields of the IP address which are pretty quick.

 

spicy
Path Finder

@bowesmana 

 

Thanks!

this will work for my needs, I only have one column of blacklist ips.

0 Karma
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 ...