Getting Data In

Regex extraction and then concatenation of multiple capture groups

ebs
Communicator

Hi,

I have a log that has the following: dn=site,dn=com,dn=au

I would like to extract and concatenate all these fields into a single capture group with periods between the words so the extracted field looks like site.com.au

How can I do this with regex?

Labels (1)
0 Karma
1 Solution

venkatasri
SplunkTrust
SplunkTrust

your props against sourcetype/host/source should be deployed to SH.

## props.conf
[<your_st/host::/source::>]
EXTRACT-dn=(?<x>[^,]+),dn=(?<y>[^,]+),dn=(?<z>[^,]+)
EVAL-site=x.".".y.".".z

 

View solution in original post

venkatasri
SplunkTrust
SplunkTrust

@ebs try this

<your_search>
| rex "dn=(?<x>[^,]+),dn=(?<y>[^,]+),dn=(?<z>[^,]+)" 
| eval site=x.".".y.".".z
0 Karma

ebs
Communicator

Thanks but I don't want to do it via a search and rex command. I want to do it as a field extraction. Do you have any insights on how to do it this way?

Tags (1)
0 Karma

venkatasri
SplunkTrust
SplunkTrust

your props against sourcetype/host/source should be deployed to SH.

## props.conf
[<your_st/host::/source::>]
EXTRACT-dn=(?<x>[^,]+),dn=(?<y>[^,]+),dn=(?<z>[^,]+)
EVAL-site=x.".".y.".".z

 

Get Updates on the Splunk Community!

Index This | I’m short for "configuration file.” What am I?

May 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with a Special ...

New Articles from Academic Learning Partners, Help Expand Lantern’s Use Case Library, ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...