Include field names before docs (data)

In order to export docs from Elasticsearch, I'm trying to utilize Csv output plugin | Logstash Reference for that, however I stumble upon small issue..

Is there a way to add field names as first line (before data)?

Not that I can see. The code does this.

csv_values = @fields.map {|name| get_value(name, event)}
csv_values.to_csv(@csv_options)

map returns an array of field values, so by the time to_csv is called the association with the names has been lost.

It would be possible to modify the output to have an option to add a header row and this has been requested, but no such option currently exists.

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