Kibana CSV report only contains one line

When we are trying to generate a csv report in Kibana, the end result only contains the headers and the first line.

If I check the .reporting index the result is there just fine with all the desired lines.

However I've realized that the issue is related to new line characters (\n). The problem is that one of the column's values contain a newline character at the end of every string, and this somehow is taken as a literal new line when generating the csv.

Example:

"message":"some sample text\n"

This will end up looking like this in the .reporting index (output.content field of the JSON object):

"some sample text
"

Instead of:

"some sample text"

Is there a way to solve this issue without manipulating the JSON object in the .reporting index?

To answer my own question:

I had to modify the csv generator code.

kibana-6.3\x-pack\plugins\reporting\export_types\csv\server\lib\format_csv_values.js

Replace:

return value.toString();

With:

return value.toString().replace(/\n$/, "");

Restart Kibana and it works.

1 Like

Thanks for looping back and posting your solution here.

Cheers
Rashmi

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.