Splunk Search

Can eval if match be used with inputlookup?

chrisfrigo
Path Finder

So what I'm trying trying to achieve is searching a field for contained in a CSV file, not an exact match. I can do this with single word using

| eval catch=if(match(field123,"contain-word"),"matches","other") | search catch=matches

but wondering if there's some way of using inputlookups or if anyone can recommend another way to search a field containing with a input file. This is what I have tried.

| eval catch=if(match(field123,"[| inputlookup input-file]"),"matches","other") | search catch=matches

Tags (2)

Raghav2384
Motivator

Try this logic...

...base search [|inputlookup xyz.csv|eval Catch = if(match(field1,"matching term"),"match","other")|where Catch = "match"|fields Field_i_need_from_lookup]

So basically, you are applying the match function on lookup first and retrieving needed field where Catch = Match and passing it to the parent search.

Hope this helps.

Thanks,
Raghav

0 Karma

chrisfrigo
Path Finder

hmmm... the matching terms are the text contained in the CSV so not sure this will work.

0 Karma

chrisfrigo
Path Finder

I'm trying to search words contained in a CSV file in a particular field, hence why I was trying to use inputlookup in the match criteria.

0 Karma
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...