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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...