# Need to upload Files as gz on to S3

**URL:** <https://discuss.elastic.co/t/need-to-upload-files-as-gz-on-to-s3/379436>\
**Category:** Logstash\
**Created:** [June 24, 2025, 12:11pm UTC](https://discuss.elastic.co/t/need-to-upload-files-as-gz-on-to-s3/379436 "2025-06-24T12:11:44Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![suhassalavathsa782](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/suhassalavathsa782/32/143816_2.png) [@suhassalavathsa782](https://discuss.elastic.co/u/suhassalavathsa782)\
**Post date:** [June 24, 2025, 12:11pm UTC](https://discuss.elastic.co/t/need-to-upload-files-as-gz-on-to-s3/379436/1 "2025-06-24T12:11:44Z")

</div>

Hi, I am working on a functionality with logstash where it reads logs from AWS MSK Kafka and sends it to S3. I use the S3 output plugin and it sends in its default format as a .txt file. My requirement was to send logs based on the below config in the output section.  
time\_file =\> 15  
size\_file =\> 488

I need a solution where I can send logs in .gz format based on time file and size file. Any pointers if it is doable in logstash ?

Reference of my output code:

s3 {  
bucket =\> "logstash-poc"  
region =\> "us-east-1"  
prefix =\> "custom-logs/%{account\_id}/%{log\_group\_flat}/"  
codec =\> json\_lines  
time\_file =\> 15  
size\_file =\> 488  
canned\_acl =\> "private"  
}  
stdout {  
codec =\> rubydebug  
}

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 24, 2025, 1:06pm UTC](https://discuss.elastic.co/t/need-to-upload-files-as-gz-on-to-s3/379436/2 "2025-06-24T13:06:39Z")

</div>

I'm not sure as a I do not use this output, but according to the [documentation](https://www.elastic.co/docs/reference/logstash/plugins/plugins-outputs-s3#plugins-outputs-s3-encoding), it seems that you need to set `encoding` to `gzip`.
