# How do I include field-names into CSV file?

**URL:** <https://discuss.elastic.co/t/how-do-i-include-field-names-into-csv-file/117113>\
**Category:** Logstash\
**Created:** [January 25, 2018, 8:10pm UTC](https://discuss.elastic.co/t/how-do-i-include-field-names-into-csv-file/117113 "2018-01-25T20:10:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [January 25, 2018, 8:10pm UTC](https://discuss.elastic.co/t/how-do-i-include-field-names-into-csv-file/117113/1 "2018-01-25T20:10:18Z")

</div>

Hello,

I'm using [Elasticsearch input plugin](https://www.elastic.co/guide/en/logstash/current/plugins-inputs-elasticsearch.html) with [Csv output plugin](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-csv.html) as part of my pipeline.

now, generated CSV file has skip fields that are NULL in elasticsearch's document and that presents an issue as I can't really identify these fields, as generated file's fields are out of order...

How can I include field-names into generated CSV file at the top?

Please advise.

---

<div class="post-metadata">

**Author:** ![alexus](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alexus/32/12696_2.png) [@alexus](https://discuss.elastic.co/u/alexus)\
**Post date:** [January 25, 2018, 8:29pm UTC](https://discuss.elastic.co/t/how-do-i-include-field-names-into-csv-file/117113/2 "2018-01-25T20:29:16Z")

</div>

Thanks to `darkmoonvt` @IRC, the answer was easier than I thought) and even though it doesn't add field-names on top of CSV file, at least now each field is identifiable)

* * *

[Csv output plugin | Logstash Reference [6.1] | Elastic](https://www.elastic.co/guide/en/logstash/current/plugins-outputs-csv.html#plugins-outputs-csv-fields)

---

<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:** [February 22, 2018, 8:29pm UTC](https://discuss.elastic.co/t/how-do-i-include-field-names-into-csv-file/117113/3 "2018-02-22T20:29:34Z")

</div>

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