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's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...

Getting Started with Splunk Artificial Intelligence, Insights for Nonprofits, and ...

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

Splunk Observability Cloud’s AI Assistant in Action Series: Identifying Unknown ...

Agentic AI powers the Splunk AI Assistant within the Splunk Observability Cloud interface to help you quickly ...