Splunk Search

Splitting a multivalue field on carreige return

jeffsegal
Explorer

good morning,
I am in the process of breaking out data from a data source that in one field contains a list of similar data for a single device (example below).

example:
(app | version\napp |version\n....)

I have been trying to use a split command using \n as the delimiter and that seems to be working, but when I try to expand the events, only a fraction of the events return. I have included a sample of the code i've been using for your review.

.....|eval new=split(_raw,"\n") |mvexpand new

This seems pretty straight forward, but it doesn't throw an error and it does bring back data, but a small fraction of the what the total should be.

Any suggestions would be greatly appreciated?

Tags (1)
0 Karma

somesoni2
Revered Legend

Try like this

....| eval new=_raw | eval new=split(new,"\\n") |mvexpand new

OR (if above doesn't work)

--- | eval new=replace(_raw,"[\r\n]+","##LBreak##") | makemv new delim="##LBreak##" | mvexpand new
0 Karma
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!

Community Content Calendar, September edition

Welcome to another insightful post from our Community Content Calendar! We're thrilled to continue bringing ...

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...