Csv s3 format

How to convert logstash output of JDBC input plugin (fetching data from psql DB) to csv format and store the same in s3 bucket?

I want to store the files in s3 bucket only in csv gzip format. S3 plugin does not provide any option to convert the event into csv format. Any help appreciated.