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!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...