Splunk Search

Convert single row values to multiple rows

srinathd
Contributor

Hi Srinath,

Srinath     USER1   IND0010001
              USER2     IND0010002
              USER3     IND0010003      

how to convert above single row values to seperate rows like below

Srinath USER1 IND0010001

Srinath USER2 IND0010002

Srinath USER3 IND0010003

Thanks,
Srinath

Tags (1)
0 Karma

somesoni2
Revered Legend

Try this

index=test sourcetype=testuser | makemv delim="xFD" APPLICATION | makemv delim="xFD" COMPANY | makemv delim="xFD" FUNCTION | stats list(APPLICATION) as application, list(COMPANY_RESTR) as company, list(FUNCTION) as function by USER_NAME | eval temp=mvzip(mvzip(application,company,"#"),function,"#") | mvexpand temp | rex field=temp "(?<application>.*)#(?<company>.*)#(?<function>.*)" | fields - temp
0 Karma

crepantherx
Loves-to-Learn Everything
I also need to do this..... would you please explain me the code I didn't understood.

What is APPLICATION, FUNCTION... and USER_NAME here ? and how does it works
0 Karma

srinathd
Contributor

It is fetching the first record for each user if any of the field which is used in the mvzip is null otherwise it is fetching all the records. It is working well if all the values present.

0 Karma

srinathd
Contributor

Thanks a lot.. it is working well

0 Karma

lguinn2
Legend

How did you get the results that you are showing? What was the original search string? What does the data look like? Without this information, I don't think the community can help much.

0 Karma

srinathd
Contributor

This is the search quiery

index=test sourcetype=testuser | makemv delim="\xFD" APPLICATION | makemv delim="\xFD" COMPANY | makemv delim="\xFD" FUNCTION | stats list(APPLICATION) as application, list(COMPANY_RESTR) as company, list(FUNCTION) as function by USER_NAME

0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...