Splunk Search

Splunk Regex Field Extractions

franciscoz1
Engager

When writing regex, where in the regex string am I supposed to add the (?<new_field>) string ?

I have included a sample regex string below, where in this string would I add (?<new_field>) ?

(?<=\:\[)(.*)(?=\])

Thanks !

Labels (2)
0 Karma
1 Solution

bowesmana
SplunkTrust
SplunkTrust

If that is the exact regex and you are talking about using the rex command, then 

 

| rex "(?<new_field>(?<=\:\[)(.*)(?=\]))"

 

will extract the data between the [] into new_field

View solution in original post

franciscoz1
Engager

Worked like a charm, thank you !

0 Karma

bowesmana
SplunkTrust
SplunkTrust

If that is the exact regex and you are talking about using the rex command, then 

 

| rex "(?<new_field>(?<=\:\[)(.*)(?=\]))"

 

will extract the data between the [] into new_field

Get Updates on the Splunk Community!

Let’s Talk Terraform

If you’re beyond the first-weeks-of-a-startup stage, chances are your application’s architecture is pretty ...

Cloud Platform | Customer Change Announcement: Email Notification is Available For ...

The Notification Team is migrating our email service provider. As the rollout progresses, Splunk has enabled ...

Save the Date: GovSummit Returns Wednesday, December 11th!

Hey there, Splunk Community! Exciting news: Splunk’s GovSummit 2024 is returning to Washington, D.C. on ...