Splunk Search

Using LOOKUP to insert a Regex string - is it possible?

ipicbc
Explorer

I want to insert a different regex string into my query for each host. I am thinking that a way to achieve this is by making a lookup into a CSV to retrieve the regex string, allocating to a new field, and then inserting it further on in the query.

Is this possible or ridiculous?

Thanks for your advice

Tags (1)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

That's entirely possible. Say your lookup looks like this:

host,expression
A,foo
B,bar

Add your lookup to your data as automatic, and search like this:

base search | where match(some_field, expression)

That would filter to only keep events where the host-based expression matches some_field.

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

expression is the field produced by the automatic lookup.

0 Karma

ipicbc
Explorer

Thanks. How would I get the regex statement into expression?

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...