# Kibana CSV report only contains one line

**URL:** <https://discuss.elastic.co/t/kibana-csv-report-only-contains-one-line/150894>\
**Category:** Kibana\
**Created:** [October 3, 2018, 1:07pm UTC](https://discuss.elastic.co/t/kibana-csv-report-only-contains-one-line/150894 "2018-10-03T13:07:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kvin](https://avatars.discourse-cdn.com/v4/letter/k/e99b99/32.png) [@Kvin](https://discuss.elastic.co/u/Kvin)\
**Post date:** [October 3, 2018, 1:07pm UTC](https://discuss.elastic.co/t/kibana-csv-report-only-contains-one-line/150894/1 "2018-10-03T13:07:41Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Kvin](https://avatars.discourse-cdn.com/v4/letter/k/e99b99/32.png) [@Kvin](https://discuss.elastic.co/u/Kvin)\
**Post date:** [October 3, 2018, 1:55pm UTC](https://discuss.elastic.co/t/kibana-csv-report-only-contains-one-line/150894/2 "2018-10-03T13:55:36Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rashmi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rashmi/32/16391_2.png) [@rashmi](https://discuss.elastic.co/u/rashmi)\
**Post date:** [October 3, 2018, 5:16pm UTC](https://discuss.elastic.co/t/kibana-csv-report-only-contains-one-line/150894/3 "2018-10-03T17:16:56Z")

</div>

Thanks for looping back and posting your solution here.

Cheers  
Rashmi

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [October 31, 2018, 5:17pm UTC](https://discuss.elastic.co/t/kibana-csv-report-only-contains-one-line/150894/4 "2018-10-31T17:17:03Z")

</div>

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