Splunk Search

rex field? - extraction

André
Engager

Hi,

I want to extract the following term from this message:

 

(MaRSEPbac, [MaRSEPbac_Old2], [MaRSEPbac])

that means the string between ()..

message:
16:21:32.843 [gcp-pubsub-subscriber1] INFO  zbank.harissa.cockpit.InboundGateway - update: [export_service] context:RDB (MaRSEPbac, [MaRSEPbac_Old2], [MaRSEPbac]) progress:3/3 status:successful msg:exporting rrid: [8d9a85b8-0d34-4dea-8901-17520b4b9b9d] rrid:f50a0cce-af13-4e64-88aa-84de045380ca

How does it goes?

Thanks!

Labels (1)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @André,

can you confirm that in your logs there's always the string "context:"?

if yes, you could use this regex:

| rex "context:\w+\s\((?<your_field>[^\)]+)"

that you can test at https://regex101.com/r/irfJhy/1

If the above condition isn't present, please share a fixed point in your logs.

Ciao.

Giuseppe

View solution in original post

André
Engager

 

Thanks Giuseppe, it works:

Andr_1-1635499157449.png

Thanks for link!

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @André,

good for you, see next time!

Ciao and happy splunking.

Giuseppe

P.S.: Karma Points are appreciated 😉

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @André,

can you confirm that in your logs there's always the string "context:"?

if yes, you could use this regex:

| rex "context:\w+\s\((?<your_field>[^\)]+)"

that you can test at https://regex101.com/r/irfJhy/1

If the above condition isn't present, please share a fixed point in your logs.

Ciao.

Giuseppe

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...