Splunk Search

search field for many values

ltruesda
Explorer

I need a search which returns events where a specific field contains any one of many values. Typically this is done with the "OR" logical operator. However, I need to search for thousands of values which cannot be expressed using a regular expression.

I've seen discussions of using "lookups" for this. However, if I understand correctly, that would require administrative access to the Splunk server (which I don't have) to configure the lookup file and later update it.

I've also seen suggestions to write a script to generate a massive search string with all the "OR"s in it. I'd like to investigate other solutions before adopting that idea.

Ideally, I'd like to provide the list of field values to match in a file.

Is there a way?

Thanks,

Larry

Tags (3)
0 Karma
1 Solution

lguinn2
Legend

You don't need administrative access to the Splunk server to create a lookup. You can use the GUI.
The instructions are in the Splunk Tutorial here

View solution in original post

lguinn2
Legend

You don't need administrative access to the Splunk server to create a lookup. You can use the GUI.
The instructions are in the Splunk Tutorial here

ltruesda
Explorer

I confirmed that it is true that you can provision the lookup_file via manager. 🙂

I ended up using "... | lookup lookup_file.csv user_id_field as user | search tag_field = 1" where the lookup_file has two columns, user_id_field and tag_field". And each row contains a userid and a '1'.

Works great. Thanks!

0 Karma

stevenacasey
New Member

splunk tutorial link is broken

0 Karma

ltruesda
Explorer

Hello, thanks for your suggestion, but as mentioned in my question I have looked into lookups and I believe it would require administrative access to the Splunk server to configure (e.g. edit .conf file and upload lookup file to appropriate folder) and maintain (e.g. replace lookup file when the search terms change) the lookup files. This is something I do not have and cannot get.

0 Karma

kristian_kolb
Ultra Champion

Perhaps you can investigate the inputlookup / outputlookup methods of creating and maintaining a lookup file, e.g.

|inputlookup file | modify stuff | outputlookup file

http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Inputlookup
http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Outputlookup

http://blogs.splunk.com/2011/01/11/maintaining-state-of-the-union/

/K

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!

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

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...