qihaiyan commented on code in PR #7749:
URL: https://github.com/apache/apisix/pull/7749#discussion_r950980915


##########
apisix/plugins/log-rotate.lua:
##########
@@ -251,7 +263,18 @@ local function rotate()
     if now_time < rotate_time then
         -- did not reach the rotate time
         core.log.info("rotate time: ", rotate_time, " now time: ", now_time)
-        return
+
+        local log_file = 
assert(io_open(default_logs[DEFAULT_ACCESS_LOG_FILENAME].file, "r"))
+        local access_log_file_size = file_size(log_file)
+        log_file:close()
+
+        log_file = 
assert(io_open(default_logs[DEFAULT_ERROR_LOG_FILENAME].file, "r"))
+        local error_log_file_size = file_size(log_file)
+        log_file:close()
+
+        if max_size <= 0 or access_log_file_size < max_size and 
error_log_file_size < max_size then

Review Comment:
   Should we rotated  access log and error log separately by max_size? 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to