Open max-wittig opened 4 years ago
An error occured in the
on_complete
uploader {:exception=>ArgumentError, :message=>"parent directory is world writable, FileUtils#remove_entry_secure does not work; abort: \"/tmp/logstash/61d8c520-7e48-4223-9fa3-e0f23d42a42a\" (parent directory mode 40777)", :path=>"/tmp/logstash/61d8c520-7e48-4223-9fa3-e0f23d42a42a/ls.s3.64c857d6-1f27-4829-afe1-6723193bcc5e.2019-11-27T10.10.part26.txt.gz", :backtrace=>["uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/fileutils.rb:685:inremove_entry_secure'", "uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/fileutils.rb:611:in
block in rm_r'", "org/jruby/RubyArray.java:1800:ineach'", "uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/fileutils.rb:609:in
rm_r'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-s3-4.1.10/lib/logstash/outputs/s3/temporary_file.rb:54:indelete!'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-s3-4.1.10/lib/logstash/outputs/s3.rb:379:in
clean_temporary_file'", "org/jruby/RubyMethod.java:120:incall'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-s3-4.1.10/lib/logstash/outputs/s3/uploader.rb:52:in
upload'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/logstash-output-s3-4.1.10/lib/logstash/outputs/s3/uploader.rb:29:inblock in upload_async'", "/usr/share/logstash/vendor/bundle/jruby/2.5.0/gems/concurrent-ruby-1.1.5/lib/concurrent/executor/java_executor_service.rb:85:in
run'"]}
Seeing the same thing in a Kubernetes hosted container, temp dir is mounted into an emptyDir volume, but old temp files aren't being cleaned up.
This only appears to be an issue if the temporary directory is world writable i.e. a volume mount point.
On our Kubernetes deployment, we've mounted /tmp/logstash as a volume, then changed the temporary file directory:
temporary_directory => "/tmp/logstash/s3"
The s3 directory gets created at container startup (assuming it doesn't already exist) and files are deleted correctly.
Similar issues:
The temporary folder is mounted inside a container. When I tried to manually delete tmpfiles inside the container, that seems to work. But the logstash doesn't delete files on it's own after upload