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!

Announcing the Expansion of the Splunk Academic Alliance Program

The Splunk Community is more than just an online forum — it’s a network of passionate users, administrators, ...

Learn Splunk Insider Insights, Do More With Gen AI, & Find 20+ New Use Cases You Can ...

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

Buttercup Games: Further Dashboarding Techniques (Part 7)

This series of blogs assumes you have already completed the Splunk Enterprise Search Tutorial as it uses the ...