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!

What Is Splunk? Here’s What You Can Do with Splunk

Hey Splunk Community, we know you know Splunk. You likely leverage its unparalleled ability to ingest, index, ...

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...