Splunk Search

Can I do named capture in transforms.conf FORMAT = ipaddress::$1.$2.$3.$4?

hylam
Contributor

In addition to $1 $2 $3..., does it support (?<namedField>...)?
http://docs.splunk.com/Documentation/Splunk/6.3.1/Admin/Transformsconf

0 Karma
1 Solution

woodcock
Esteemed Legend

Yes, you can, like this:

[SomeArbitraryNameHere]
SOURCE_KEY=YourSourceFieldName
REGEX=Your RegEx with (?<NamedCapture>.*) Here

You need a props.conf reference to SomeArbitraryNameHere to trigger it.

View solution in original post

0 Karma

woodcock
Esteemed Legend

Yes, you can, like this:

[SomeArbitraryNameHere]
SOURCE_KEY=YourSourceFieldName
REGEX=Your RegEx with (?<NamedCapture>.*) Here

You need a props.conf reference to SomeArbitraryNameHere to trigger it.

0 Karma

hylam
Contributor

thx it worked

Use $n (such as $1, $2, and so on) to specify regex match outputs. Default is ::$1
Is the default in the Field Transformation GUI suppressed by default?

0 Karma

richgalloway
SplunkTrust
SplunkTrust

The way I read this paragraph, groups can only be referred to by number.

When you create concatenated fields with FORMAT, "$" is the only special
character. It is treated as a prefix for regex-capturing groups only if
it is followed by a number and only if the number applies to an existing
capturing group.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Earn a $35 Gift Card for Answering our Splunk Admins & App Developer Survey

Survey for Splunk Admins and App Developers is open now! | Earn a $35 gift card!      Hello there,  Splunk ...

Continuing Innovation & New Integrations Unlock Full Stack Observability For Your ...

You’ve probably heard the latest about AppDynamics joining the Splunk Observability portfolio, deepening our ...

Monitoring Amazon Elastic Kubernetes Service (EKS)

As we’ve seen, integrating Kubernetes environments with Splunk Observability Cloud is a quick and easy way to ...