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!

AppDynamics Summer Webinars

This summer, our mighty AppDynamics team is cooking up some delicious content on YouTube Live to satiate your ...

SOCin’ it to you at Splunk University

Splunk University is expanding its instructor-led learning portfolio with dedicated Security tracks at .conf25 ...

Credit Card Data Protection & PCI Compliance with Splunk Edge Processor

Organizations handling credit card transactions know that PCI DSS compliance is both critical and complex. The ...