# Missing headers even with include\_headers (Csv codec plugin) set to true

**URL:** <https://discuss.elastic.co/t/missing-headers-even-with-include-headers-csv-codec-plugin-set-to-true/327555>\
**Category:** Logstash\
**Created:** [March 13, 2023, 1:22pm UTC](https://discuss.elastic.co/t/missing-headers-even-with-include-headers-csv-codec-plugin-set-to-true/327555 "2023-03-13T13:22:15Z")\
**Posts on this page:** 7\
**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:** [March 13, 2023, 1:22pm UTC](https://discuss.elastic.co/t/missing-headers-even-with-include-headers-csv-codec-plugin-set-to-true/327555/1 "2023-03-13T13:22:15Z")

</div>

Hello World!

per [Csv codec plugin | Logstash Reference [7.17] | Elastic](https://www.elastic.co/guide/en/logstash/7.17/plugins-codecs-csv.html#plugins-codecs-csv-include_headers)

I'm set `include_headers` flag to value `true`, yet even though headers gets included into output on first run, at later time on re-run schedule of very same pipeline, the headers are no longer included into output...

per the above mention documentation, may be it has something to do with this?

> When **encoding** in an output plugin, include headers in the encoded CSV once per codec lifecyle (not for every event)

* * *

How do I enforce `include_headers` at _ALL_ time (not the just first run)?

Please advise)  
Thank you in advance!

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 13, 2023, 10:15pm UTC](https://discuss.elastic.co/t/missing-headers-even-with-include-headers-csv-codec-plugin-set-to-true/327555/2 "2023-03-13T22:15:34Z")

</div>

> [@alexus](#):
>
> at later time on re-run schedule of very same pipeline

It is unclear what you mean by that. How are you scheduling it?

---

<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:** [March 14, 2023, 1:31pm UTC](https://discuss.elastic.co/t/missing-headers-even-with-include-headers-csv-codec-plugin-set-to-true/327555/3 "2023-03-14T13:31:49Z")

</div>

@Badger thank you for your reply.

I use [scheduling](https://www.elastic.co/guide/en/logstash/7.17/plugins-inputs-elasticsearch.html#_scheduling) for schedule of re-run of same pipeline.

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 14, 2023, 2:42pm UTC](https://discuss.elastic.co/t/missing-headers-even-with-include-headers-csv-codec-plugin-set-to-true/327555/4 "2023-03-14T14:42:44Z")

</div>

> [@alexus](#):
>
> I use [scheduling](https://www.elastic.co/guide/en/logstash/7.17/plugins-inputs-elasticsearch.html#_scheduling) for schedule of re-run of same pipeline.

The codec only outputs headers [once](https://github.com/logstash-plugins/logstash-codec-csv/blob/ce2456090671b9852d42bd6896f69b80e668e395/lib/logstash/codecs/csv.rb#L171) in its lifecycle. With scheduling the pipeline does not restart, it just sleeps until the next scheduled time, so it is not going to output headers again.

---

<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:** [March 14, 2023, 3:32pm UTC](https://discuss.elastic.co/t/missing-headers-even-with-include-headers-csv-codec-plugin-set-to-true/327555/5 "2023-03-14T15:32:49Z")

</div>

ok, thanks for the explanation)

a follow up question, is there a way to enforce it every time (vs first time only) somehow?

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [March 14, 2023, 4:34pm UTC](https://discuss.elastic.co/t/missing-headers-even-with-include-headers-csv-codec-plugin-set-to-true/327555/6 "2023-03-14T16:34:56Z")

</div>

> [@alexus](#):
>
> is there a way to enforce it every time (vs first time only)

Not within logstash itself. It could probably be done externally. For example, if you have --config.reload.automatic enabled and path.config pointed to a directory and you want to schedule execution every 10 minutes, then you could create a file with a single blank line in the directory at 10, 30, and 50 past the hour, and remove that file at 00, 20, and 40 past the hour. That would trigger a reload of the pipeline which would cause the headers to be written again. You would then remove the scheduling from the input.

---

<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:** [April 11, 2023, 4:35pm UTC](https://discuss.elastic.co/t/missing-headers-even-with-include-headers-csv-codec-plugin-set-to-true/327555/7 "2023-04-11T16:35:49Z")

</div>

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