Splunk Search

How can I search a lookup table for rows that match an input string in any field?

matstap
Communicator

I need to search a lookup table for rows that match an input string in any field.

I've tried |inputlookup...... | search $searchKey$ but this returns no results.

How do I do this?

0 Karma
1 Solution

micahkemp
Champion

Try this:

| inputlookup <lookup>
| foreach * [eval matched=if(matched="YES" OR <<FIELD>>="searchkey", "YES", "NO")]
| search matched="YES"
| fields - matched

View solution in original post

micahkemp
Champion

Try this:

| inputlookup <lookup>
| foreach * [eval matched=if(matched="YES" OR <<FIELD>>="searchkey", "YES", "NO")]
| search matched="YES"
| fields - matched

matstap
Communicator

That's what I'm looking for. Thanks

0 Karma

micahkemp
Champion
| inputlookup <lookup name> WHERE <fieldname>=<value>

Your | search version would probably work if you did | search <fieldname>=<value>, but it's better to include the filter in inputlookup itself.

0 Karma

matstap
Communicator

Is there a way to do this without specifying the field? I just want to pass in a string x and if in one row FieldA=x and in another row FieldB=x, it will return both rows

0 Karma

micahkemp
Champion

I see I didn't really answer your question. I will revisit this in a few.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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