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
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...