Splunk Search

Why are events containing multiple results when exported as csv getting merged in single row one after the other?

kgiri253
Explorer

As we can see below the two events contain multiple results. But when I try to export it as csv all these events get merged into a single row one after the other.

Currently merged output in for one event --->  result1 result2 result3 result4

But I want the data to be exported in csv as it is (i.e all the results in different rows)

 

kgiri253_1-1662637769086.png

 

 

Labels (1)
0 Karma
1 Solution

yuanliu
SplunkTrust
SplunkTrust

Oh, I took shortcut with Splunk's autoformating.  Just remove leading space after newline.

| foreach *
    [ eval <<FIELD>> = mvjoin(<<FIELD>>, "
") ]

(Autoformating is a great assistant but...) 

View solution in original post

Tags (1)

yuanliu
SplunkTrust
SplunkTrust

If line break is the only thing that matters, you can use this crude method

| foreach *
    [ eval <<FIELD>> = mvjoin(<<FIELD>>, "
    ") ]

BTW, your subject line says "imported" as opposed to "exported".

kgiri253
Explorer

@yuanliuthanks for your help, it worked but now only the first result is correctly aligned, rest of the results can be seen with extra space. Please refer to the image below.

Thanks for correcting the import -> export error

kgiri253_0-1662716781933.png

 

0 Karma

yuanliu
SplunkTrust
SplunkTrust

Oh, I took shortcut with Splunk's autoformating.  Just remove leading space after newline.

| foreach *
    [ eval <<FIELD>> = mvjoin(<<FIELD>>, "
") ]

(Autoformating is a great assistant but...) 

Tags (1)
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...