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

Index This | Forward, I’m heavy; backward, I’m not. What am I?

April 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...