Header in csv while exporting

Hi,
I want to know that is there any way through which we can add header in csv file while exporting from elasticsearch via logstash?
Here is the flow:
Elasticsearch -> logstash -> csv file

Hi,

I think this is not directly supported. If using csv_options in the csv output, you would get a header row for each event. Though I haven't tested it, it's still an open request, so I assume it's not solved: Add support for CSV header row · Issue #8 · logstash-plugins/logstash-output-csv · GitHub

In there the suggested workaround is creating a file first with the headers, and then writing the rows with Logstash. Which might not ideal.

Another workaround seems the one documented here, using ruby init that executes during Logstash startup: ruby - Logstash - csv output headers - Stack Overflow.

Thanks Imma. Just wanted to confirm that logstash is not providing any feature for headers.

1 Like