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!

.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 ...