Hi Elastic team,
I am trying to export Kafka messages into tab separated file (tsv) file using below logstash configuration file......But not able to get desired output.
input {
kafka {
bootstrap_servers => "host:port"
topics => ["kafka_topic"]
max_poll_records =>500
}
}
output {
csv {
fields => ["message","@timestamp"]
csv_options => {"write_headers" => "true" "headers" =>["message","@timestamp"] "col_sep" => "\t"}
path => "/tmp/abc.tsv"
}
}
Below are the problems facing using above conf file
- not able to export in tsv file.' \t' is appending before data in file.
for ex. a\tb instead a b. - headers are repeating after every row
for ex. a\tb
1\t2
a\tb
3\t4 - why these many opening and closing happened while running this configuration
[INFO ] 2022-07-11 13:28:08.522 [[main]>worker2] csv - Opening file {:path=>"/tmp/abc.tsv"}
[INFO ] 2022-07-11 13:28:47.067 [[main]>worker1] csv - Closing file /tmp/abc.tsv
[INFO ] 2022-07-11 13:29:27.352 [[main]>worker0] csv - Opening file {:path=>"/tmp/abc.tsv"}
[INFO ] 2022-07-11 13:29:42.042 [[main]>worker0] csv - Closing file /tmp/abc.tsv
desired output is
for ex. a b
1 2
3 4
Kindly let me know what I am missing & correct me
Thanks