Getting Data In

How do I use lookup to filter results? Need search to contain (not equal) a value

mschellhouse
Path Finder

I am looking to filter events in splunk by values in a lookup table. I implemented the solution from this question, and it is partial working:
https://answers.splunk.com/answers/110381/use-lookup-to-filter-events.html

The change that I need to make is to have my lookup values be used in a "contains" filter as apposed to a literal/equal filter.

my sample code:
-search string-
[| inputlookup searchtermsample2.csv
| fields query]
| stats count by searchTerms

So... how do I rewrite so that there are wildcards on each side of the lookup field?

0 Karma

pradeepkumarg
Influencer

Below should do

-search string- [| inputlookup searchtermsample2.csv | fields query | eval query="\*".query."\*" | table query | format] 
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...