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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...