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!

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...