Splunk Search

How to build a tranform which applies to a events with a field value found in a provided list

juniormint
Communicator

I have a index time transform which is a bit loose in what it matches. I would like to limit it to a whitelist of indexes that I want to match against. I would very much appreciate your help with creating a clean regular expression to achieve the goal.

So I think I want REGEX = match any event with a embedded field of the form index="SomeIndexName" where SomeIndexName in (App1,App2,App3).

My current transform
[MyTransform]
REGEX=.index="(.?)"
DEST_KEY=_MetaData:Index
FORMAT=$1
CLEAN_KEYS
MV_ADD=0

0 Karma
1 Solution

lukejadamec
Super Champion

The OR operator for regex is the pipe:

REGEX= index="(App1|App2|App3)"

I changed .index to just index because I'm not sure you need it.

View solution in original post

lukejadamec
Super Champion

The OR operator for regex is the pipe:

REGEX= index="(App1|App2|App3)"

I changed .index to just index because I'm not sure you need it.

juniormint
Communicator

Yes. $1 will contain the value inside the parenthesis.

juniormint
Communicator

Will $1 still contain the field value?

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...

What’s New in Splunk Security Essentials 3.8.0?

Splunk Security Essentials (SSE) is an app that can amplify the power of your existing Splunk Cloud Platform, ...