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!

There's No Place Like Chrome and the Splunk Platform

Watch On DemandMalware. Risky Extensions. Data Exfiltration. End-users are increasingly reliant on browsers to ...

The Great Resilience Quest: 5th Leaderboard Update

The fifth leaderboard update for The Great Resilience Quest is out &gt;&gt; &#x1f3c6; Check out the ...

Devesh Logendran, Splunk, and the Singapore Cyber Conquest

At this year’s Splunk University, I had the privilege of chatting with Devesh Logendran, one of the winners in ...