Splunk Search

Regex Help!

kc_prane
Communicator

My Raw log says "message: (c4328dd3-d16e-4df8-a8e6-b2ebcab9d8bc)" 

I wanted to extract everything  inside the  Parentheses ( )

 

Thanks in advance.

Labels (1)
Tags (1)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

Like this?

 

| rex "message: \((?<in_parentheseses>[^\)]+)"

 

You can test with

 

| makeresults format=csv data="_raw
message: (c4328dd3-d16e-4df8-a8e6-b2ebcab9d8bc)"
``` data emulation above ```
| rex "message: \((?<in_parentheses>[^\)]+)"

 

_rawin_parentheses
message: (c4328dd3-d16e-4df8-a8e6-b2ebcab9d8bc)c4328dd3-d16e-4df8-a8e6-b2ebcab9d8bc

View solution in original post

kc_prane
Communicator

Thank you for the help @yuanliu 

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Like this?

 

| rex "message: \((?<in_parentheseses>[^\)]+)"

 

You can test with

 

| makeresults format=csv data="_raw
message: (c4328dd3-d16e-4df8-a8e6-b2ebcab9d8bc)"
``` data emulation above ```
| rex "message: \((?<in_parentheses>[^\)]+)"

 

_rawin_parentheses
message: (c4328dd3-d16e-4df8-a8e6-b2ebcab9d8bc)c4328dd3-d16e-4df8-a8e6-b2ebcab9d8bc
Get Updates on the Splunk Community!

Fueling your curiosity with new Splunk ILT and eLearning courses

At Splunk Education, we’re driven by curiosity—both ours and yours! That’s why we’re committed to delivering ...

Splunk AI Assistant for SPL 1.1.0 | Now Personalized to Your Environment for Greater ...

Splunk AI Assistant for SPL has transformed how users interact with Splunk, making it easier than ever to ...

Unleash Unified Security and Observability with Splunk Cloud Platform

     Now Available on Microsoft AzureOn Demand Now Step boldly into the AI revolution with enhanced security ...