Splunk Search

rex to extract string

indeed_2000
Motivator

Hi I have log like this:

2022-02-01 11:59:59,869 INFO CUS.AbCD-Host-000000 [AppListener] Receive Packet[0000000*]: Cluster[String1.String2]

 

How can I extract String1 and String2 separately with a single rex like this? 

Cluster\[(?<GroupREX>\w+\.\w+)

 

Any idea?

Thanks,

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

ITWhisperer
SplunkTrust
SplunkTrust
Cluster\[(?<String1>\w+)\.(?<String2>\w+)\]

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @indeed_2000 ,

if you're sure that the division between strings is dot, you could use a regex like this:

| rex "Cluster\[(?<string1>[^\.]+)\.(?<string2>[^\]]+)"

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

Ciao.

Giuseppe

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
Cluster\[(?<String1>\w+)\.(?<String2>\w+)\]
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Level Up Your .conf25: Splunk Arcade Comes to Boston

With .conf25 right around the corner in Boston, there’s a lot to look forward to — inspiring keynotes, ...

Manual Instrumentation with Splunk Observability Cloud: How to Instrument Frontend ...

Although it might seem daunting, as we’ve seen in this series, manual instrumentation can be straightforward ...

Take Action Automatically on Splunk Alerts with Red Hat Ansible Automation Platform

 Are you ready to revolutionize your IT operations? As digital transformation accelerates, the demand for ...