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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

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