Splunk Search

Change textbook to search on multiple values?

POR160893
Builder

Hi,

I have the following search that searches an index based on 2 textbook inputs:

| inputlookup ABC
| search src=$src_tok$ OR dest=$dest_tok$



I need to change this such that multiple src's or multiple dest's are inputted at a given time by a user.

Something like the following if dest="10.175.96.146 10.175.96.147 10.175.96.148 0.175.96.149 10.175.96.150 10.175.96.183":

| inputlookup ABC
| search src=* OR (dest=10.175.96.146 AND dest=10.175.96.147 AND dest= 10.175.96.148 AND dest=10.175.96.149 AND dest=10.175.96.150 AND dest=10.175.96.183)



How can I change my current search to search on multiple inputted values?


Thanks as always 🙂

Labels (3)
0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

maybe this helps you

| inputlookup ABC
| search src=* OR [
   | makeresults 
   | eval dest="10.175.96.146 10.175.96.147 10.175.96.148 10.175.96.149 10.175.96.150 10.175.96.183" 
   | eval dest=split(dest," ") 
   | fields dest 
   | format mvsep="AND"]

r. Ismo 

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!

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

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

Ready to make your IT operations smarter and more efficient? Discover how to automate Splunk alerts with Red ...