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!

Splunk Enterprise Security 8.0.2 Availability: On cloud and On-premise!

A few months ago, we released Splunk Enterprise Security 8.0 for our cloud customers. Today, we are excited to ...

Logs to Metrics

Logs and Metrics Logs are generally unstructured text or structured events emitted by applications and written ...

Developer Spotlight with Paul Stout

Welcome to our very first developer spotlight release series where we'll feature some awesome Splunk ...