You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/12/13 04:34:35 UTC

[GitHub] [apisix] tzssangglass commented on issue #8480: bug: There is a problem with the rotation date of log-rotate plugin

tzssangglass commented on issue #8480:
URL: https://github.com/apache/apisix/issues/8480#issuecomment-1347736650

   This is related to the server time zone.
   
   On APISIX v2.13, the `rotate_time` de is calculated as follows
   
   ```lua
   rotate_time = now_time + interval - (now_time % interval)
   ```
   
   if `now_time` is `1670904900`
   
   ```
   rotate_time = 1670904900 +  246060 - (1670904900 % 246060)
   ```
   
   `rotate_time` is `1670993460`,  when this time is reached, will use the  
   
   ```
   local now_date = os_date("%Y-%m-%d_%H-%M-%S", now_time)
   ```
   
   `os_date` will use the current time zone of server, try 
   
   ```
   resty -e "local now_date = os.date(\"%Y-%m-%d_%H-%M-%S\", ngx.time());print(now_date)"
   ```
   
   anc check time zone
   
   ```
   date -R
   Tue, 13 Dec 2022 12:34:03 +0800
   ```


-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org