# File Output Pluging creates corrupted files

**URL:** <https://discuss.elastic.co/t/file-output-pluging-creates-corrupted-files/49953>\
**Category:** Logstash\
**Created:** [May 12, 2016, 11:45pm UTC](https://discuss.elastic.co/t/file-output-pluging-creates-corrupted-files/49953 "2016-05-12T23:45:37Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ingo\_Sauerzapf](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ingo_sauerzapf/32/9739_2.png) [@Ingo\_Sauerzapf](https://discuss.elastic.co/u/Ingo_Sauerzapf)\
**Post date:** [May 12, 2016, 11:45pm UTC](https://discuss.elastic.co/t/file-output-pluging-creates-corrupted-files/49953/1 "2016-05-12T23:45:37Z")

</div>

Hi everyone,  
we are using the file output plugin with gzip=true and we are getting quite a bit of corrupted files. At first we thought that it had to do with the size of the files but it appears quite randomly. Some of our files are +2GB when compressed. I looked into the file output plugin code and noticed that when new files are crated they are actually opened with

File.new(path, "a+")

[https://github.com/logstash-plugins/logstash-output-file/blob/master/lib/logstash/outputs/file.rb](https://github.com/logstash-plugins/logstash-output-file/blob/master/lib/logstash/outputs/file.rb) line 262 and 264 and I am now wondering if this should be

File.new(path, "ab+")

in the case of gzip files being binary. I am unfortunately not familiar with jRuby and am not sure if this creates the problem. Any help is highly appreciated.

Best

Ingo

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [July 6, 2017, 4:57am UTC](https://discuss.elastic.co/t/file-output-pluging-creates-corrupted-files/49953/2 "2017-07-06T04:57:46Z")

</div>

Closed on July 6, 2017, 4:57am UTC


