Splunk Search

Need to split string at last character before numeric value.

JayWest
New Member

So i have a possibly unique requirement, i'm trying to split up so log data but i have a string in one field that contains numerous peices of information both numeric and character based. The numeric fields are of fixed length which i'm able to split without isssue BUT in the string there is also a character value (persons name). Now the issue i have is that the name part of the string is not fixed length it's based on the name length so doing a split by character number is not going to produce the results.

What i wanted to ask is, Is it possible to split a string between the end of a character value and a numeric one, example would be:

From this:

** Update **

I think it may be best to post a string that is more inline to what i want to do.

So the current field data i have looks like this:

1234567801D52411021103100001860000CF19John Doe01D5232102110265000159000001D5231202110265000103400601D53324021103100000000005

Single string but in this string is multiple pieces of information. What i want to do is extract the Name (John Doe) and use the values that remains as they are of ixed length. My problem is with removing the name as that is variable length and makes it hard to split. 

Thanks in advance.

 

 

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| rex field=Field1 "(?<Field1>\D+)(?<Field2>\d+)"
0 Karma

JayWest
New Member

Thanks for the suggesting, i just tried it and didn't work out for me, i have updated my post with a full string example which may help understand what i am trying to achieve.

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Thanks, often better to use real or close to real examples rather than waste everyone's time with inaccurate fake examples.. Try this (although I suspect even this isn't wholly accurate, but you'll get the idea!)

| rex field=Field1 "(?<Field1>.{38})(?<Field2>.+)(?<Field3>.{78})"

 

0 Karma
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!

Introducing the 2026 - 2027 SplunkTrust cohort!

The goal of the SplunkTrust™ membership has historically been to acknowledge and recognize those who go above ...

(re)Introducing the Splunk Community Champions + 2026 – 2027 Splunk MVPs ...

This program exists as a channel to empower and recognize Splunk advocates and help supercharge initiatives to ...

Pro Tips for .conf26: How to Prep Like a Splunk Veteran

There’s no shortage of incredible content lined up for .conf26 in Denver, from deep-dive technical sessions ...