From b6d430d8facbcbfaf28056bc405a3fba08f4aafa Mon Sep 17 00:00:00 2001 From: Nitin Goel Date: Thu, 10 Sep 2015 09:28:34 +0530 Subject: [PATCH] Fixing the issue with deletion of temp file along with the dynamic prefix changes --- lib/logstash/outputs/s3.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/logstash/outputs/s3.rb b/lib/logstash/outputs/s3.rb index 114686a8..df149957 100644 --- a/lib/logstash/outputs/s3.rb +++ b/lib/logstash/outputs/s3.rb @@ -482,8 +482,13 @@ def reset_page_counter(key) private def delete_on_bucket(filename) bucket = @s3.buckets[@bucket] + + first = Pathname.new @temporary_directory + second = Pathname.new filename - remote_filename = "#{@prefix}#{File.basename(filename)}" + remote_filename_path = second.relative_path_from first + + remote_filename = remote_filename_path.to_s @logger.debug("S3: delete file from bucket", :remote_filename => remote_filename, :bucket => @bucket)