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!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...