Splunk Search

How to get results only if search field contains a word in the lookup table

ashishmgupta
Explorer

If I have a search result which has a field named "Field1" and It has values like :
This is Word1 now.
This is Word2 now.
This is WordX now.
This is WordZ now.

Below is the look up table for Words.

Field1
Word1
Word2
Word3
Word4
Word5
Word6

How can I search so I get ONLY below results in the output because they contain "Word1" and "Word2"?
This is Word1 now.
This is Word2 now.

0 Karma

maciep
Champion

I'd say grab the word, look it up and then filter....maybe something like this (not at all tested)

index=whatevs
| rex field=Field1 "^(?:\S+\s+){2}(?<my_word>\S+)"
| lookup word_lookup_table Field1 AS my_word OUTPUT Field1 AS found_word
| where isnotnull(found_word)

And if you didn't want to rex out the word, you could also configure your lookup to wildcard the Field1 field.
https://docs.splunk.com/Documentation/Splunk/7.3.1/Knowledge/Addfieldmatchingrulestoyourlookupconfig...

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!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...