This is an automated email from the ASF dual-hosted git repository.

juzhiyuan pushed a commit to branch fix/log-rotate-partial-reopen
in repository https://gitbox.apache.org/repos/asf/apisix.git

commit f464b1e4d022ab7de33efd67ccfacf22f90c9a7f
Author: Aiden <[email protected]>
AuthorDate: Fri May 15 03:01:36 2026 +0000

    fix(log-rotate): reopen logs after partial rotation
---
 apisix/plugins/log-rotate.lua | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/apisix/plugins/log-rotate.lua b/apisix/plugins/log-rotate.lua
index f90226d89..f963226c1 100644
--- a/apisix/plugins/log-rotate.lua
+++ b/apisix/plugins/log-rotate.lua
@@ -218,11 +218,13 @@ local function rotate_file(files, now_time, max_kept, 
timeout)
     for _, file in ipairs(files) do
         local now_date = os_date("%Y-%m-%d_%H-%M-%S", now_time)
         local new_file = rename_file(default_logs[file], now_date)
-        if not new_file then
-            return
+        if new_file then
+            core.table.insert(new_files, new_file)
         end
+    end
 
-        core.table.insert(new_files, new_file)
+    if core.table.isempty(new_files) then
+        return
     end
 
     -- send signal to reopen log files

Reply via email to