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/09/13 02:06:00 UTC

[GitHub] [apisix] kizy008 opened a new issue, #7899: help request: [file-logger] duplicate log, new log file contains history log message

kizy008 opened a new issue, #7899:
URL: https://github.com/apache/apisix/issues/7899

   ### Description
   
   In my project, I need split log file by hour and delete logs 7 days ago. So I write a rotate plugin like [log-rotate.lua], and it works.
   But I found that every new log file contains the history log message. For example, [log-2022-09-01_01-00-00.log] contains all message in [log-2022-09-01_00-00-00.log]]. So every log contains all history message.  I think the new log should contains message in its hour period. But I got all history message. 
   I want to know how to get incremental logs in new log file.
   
   我的项目中需要将日志按照小时分割并自动淘汰7天前的历史日志。 所以我仿照[log-rotate.lua]写了file-logger的滚动切割日志插件,并且按照预期生效了。但是我发现,所有的心日志文件都包含了全量的历史日志。比如 [log-2022-09-01_01-00-00.log]日志不仅包含了23点到0点的日志, 还包含了所有的历史全量日志。我本以为新日志应该只包含过去1个小时之内的日志。
   我想知道如何利用file-logger在每个日志文件中保存这个小时时间段内增量的日志呢?
   
   ### Environment
   
   - APISIX version (run `apisix version`):
   - Operating system (run `uname -a`):
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):
   - APISIX Dashboard version, if relevant:
   - Plugin runner version, for issues related to plugin runners:
   - LuaRocks version, for installation issues (run `luarocks --version`):
   


-- 
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.apache.org

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


[GitHub] [apisix] tzssangglass closed issue #7899: help request: [file-logger] duplicate log, new log file contains history log message

Posted by GitBox <gi...@apache.org>.
tzssangglass closed issue #7899: help request:  [file-logger] duplicate log, new log file contains history log message
URL: https://github.com/apache/apisix/issues/7899


-- 
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


[GitHub] [apisix] monkeyDluffy6017 commented on issue #7899: help request: [file-logger] duplicate log, new log file contains history log message

Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #7899:
URL: https://github.com/apache/apisix/issues/7899#issuecomment-1244828440

   1. rename old log file and create new one
   2. notify other processes to reopen the file
   Do you follow the two steps ?


-- 
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


[GitHub] [apisix] AlphaChen commented on issue #7899: help request: [file-logger] duplicate log, new log file contains history log message

Posted by GitBox <gi...@apache.org>.
AlphaChen commented on issue #7899:
URL: https://github.com/apache/apisix/issues/7899#issuecomment-1244838993

   > 1. rename old log file and create new one
   > 2. notify other processes to reopen the file
   > 
   > Do you follow the two steps ?
   
   how to notify other processes 


-- 
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


[GitHub] [apisix] AlphaChen commented on issue #7899: help request: [file-logger] duplicate log, new log file contains history log message

Posted by GitBox <gi...@apache.org>.
AlphaChen commented on issue #7899:
URL: https://github.com/apache/apisix/issues/7899#issuecomment-1244838640

   > 
   
   how to notify? can show some code


-- 
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


[GitHub] [apisix] AlphaChen commented on issue #7899: help request: [file-logger] duplicate log, new log file contains history log message

Posted by GitBox <gi...@apache.org>.
AlphaChen commented on issue #7899:
URL: https://github.com/apache/apisix/issues/7899#issuecomment-1244819733

   i meet same problem


-- 
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


[GitHub] [apisix] monkeyDluffy6017 commented on issue #7899: help request: [file-logger] duplicate log, new log file contains history log message

Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #7899:
URL: https://github.com/apache/apisix/issues/7899#issuecomment-1244845414

   You could use [ngxsharedict](https://github.com/openresty/lua-nginx-module#ngxshareddict) to notify other processes.
   For example
   
   ```
   -- process 1
   local rotate = ngx.shared.rotate
   rotate:set("reopen", true)
   ```
   
   ```
   -- process 2
   local rotate = ngx.shared.rotate
   local reopen = rotate:get("reopen")
   if reopen then
       -- reopen file
   end
   ```
   
   


-- 
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


[GitHub] [apisix] tzssangglass commented on issue #7899: help request: [file-logger] duplicate log, new log file contains history log message

Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #7899:
URL: https://github.com/apache/apisix/issues/7899#issuecomment-1244867569

   Since this is your own code, not related to the project, I turned it into discussion.


-- 
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