From ad72757bf18395a08199bdafb17deb24c1d4c14d Mon Sep 17 00:00:00 2001 From: Shizuo Fujita Date: Wed, 20 Nov 2024 16:43:51 +0900 Subject: [PATCH] out_s3: add log to output unexpected error of Tempfile#close It is difficult to take any action deal with as there was no output if Tempfile#close caused unexpected error. So, this patch will add a log to know that an error has occurred in Tempfile#close. Signed-off-by: Shizuo Fujita --- lib/fluent/plugin/out_s3.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/fluent/plugin/out_s3.rb b/lib/fluent/plugin/out_s3.rb index 71f14c6..b04ee6c 100644 --- a/lib/fluent/plugin/out_s3.rb +++ b/lib/fluent/plugin/out_s3.rb @@ -388,7 +388,11 @@ def write(chunk) end end ensure - tmp.close(true) rescue nil + begin + tmp.close(true) + rescue => e + log.info "out_s3: Tempfile#close caused unexpected error", error: e + end end end