Splunk Search

How to split a string into 2 separate fields in Splunk 6.5.0?

HeinzWaescher
Motivator

Hi,

before Splunk 6.5.0 I used commands like this to split strings into separate fields.

For fields like productId=abc_text_def

 | rex field=productId "(?<field1>.*)\_text_(?<field2>.*)"

Since 6.5.0 this does not work anymore. The error is:

Error in 'rex' command: Encountered the following error while compiling the regex '(?<field1>.*)\_text_(?<field2>.*): Regex: unrecognized character follows \

Can you help me to fix this?

0 Karma
1 Solution

cmerriman
Super Champion
| rex field=productId "(?<field1>.*)_text_(?<field2>.*)"

try it without the \ does it work?

View solution in original post

cmerriman
Super Champion
| rex field=productId "(?<field1>.*)_text_(?<field2>.*)"

try it without the \ does it work?

HeinzWaescher
Motivator

that was fast & easy, thanks a lot 🙂

0 Karma
Get Updates on the Splunk Community!

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...