Splunk Search

How to split multiple lines of data into a single individual line in splunk using \n?

Shan
Builder

As i mentioned below prod column has multiple values and i want to split it based on \n next line command and get the output as mentioned in output image.

Current data:

Shan_0-1629728821294.png

Expected output:

Shan_1-1629728934077.png

Thanks in advance ..

Labels (1)
0 Karma
1 Solution

Shan
Builder

@ITWhisperer 

Thanks for your input . As i mentioned Split not helped me.
I can able to achieve what i expected with below solution.

| makemv tokenizer="([^\r\n]+)(\r\n)?" Prod
| mvexpand Prod

🙂

View solution in original post

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| eval Prod=split(Prod,"
")
| mvexpand Prod

Shan
Builder

@ITWhisperer 

Thanks for your input. But its not working .

Shan_1-1629731597744.png

0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

The split has the newline in quotes - hint: use <shift><return> to insert into search

0 Karma

Shan
Builder

@ITWhisperer 

Sorry, I'm not able to follow you. Can you please give me an example query..

Thanks in advance ..

Tags (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust
| eval Prod=split(Prod,"
")
| mvexpand Prod

If this is not working, can you share your search in the same way i.e. in a code block </>

0 Karma

Shan
Builder

@ITWhisperer 

Thanks for your input . As i mentioned Split not helped me.
I can able to achieve what i expected with below solution.

| makemv tokenizer="([^\r\n]+)(\r\n)?" Prod
| mvexpand Prod

🙂

0 Karma
Get Updates on the Splunk Community!

What You Read The Most: Splunk Lantern’s Most Popular Articles!

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Announcing the General Availability of Splunk Enterprise Security 8.1!

We are pleased to announce the general availability of Splunk Enterprise Security 8.1. Splunk becomes the only ...

Developer Spotlight with William Searle

The Splunk Guy: A Developer’s Path from Web to Cloud William is a Splunk Professional Services Consultant with ...