Write output csv file with header

Hi there,,,

I am Formatting my input file and writing the formatted input to a .csv file. Using Below code snippet.

output {
elasticsearch {
hosts => ["localhost:9200"]
index => "Sample_index"
document_type => "sample_doc"
}
csv {
fields => ["A", "B", "C"]
path => "output_path.csv"
}
stdout { codec => rubydebug }
}

The above snippet creates an output file with fields "A","B","C".
Problem (1) Output file is created without header. Is there any way to add header??
What I tried - In csv_options I gave headers. But header was added before each message which was not expected.
Problem (2) Everytime when I run logstash output is appended to the existing output file. Is there any solution to open a new file for each run of logstash???
What I tried - In csv_options I included write_behaviour => overwrite.I didn't get any error. But It didn't work.

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