From af158c05b6dfb2e992df94cd1255e968b6be93fd Mon Sep 17 00:00:00 2001 From: Lucas Pires Date: Thu, 8 Apr 2021 18:40:38 +0200 Subject: [PATCH] fix create_if_deleted logic by closing the file handle, Closes #81 --- lib/logstash/outputs/file.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/logstash/outputs/file.rb b/lib/logstash/outputs/file.rb index 7941b4d..6961899 100644 --- a/lib/logstash/outputs/file.rb +++ b/lib/logstash/outputs/file.rb @@ -246,8 +246,8 @@ def open(path) if deleted?(path) if @create_if_deleted - @logger.debug("Required path was deleted, creating the file again", :path => path) - @files.delete(path) + @logger.debug("Required path was deleted, creating the file again, and releasing old handle", :path => path) + @files.delete(path).close if cached?(path) else return @files[path] if cached?(path) end