You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by "zsmlinux (via GitHub)" <gi...@apache.org> on 2023/03/14 06:55:18 UTC

[GitHub] [apisix] zsmlinux opened a new issue, #9061: bug: log-rotate max_kept doesn't work

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

   ### Current Behavior
   
   log-rotate max_kept doesn't work
   
   ### Expected Behavior
   
   _No response_
   
   ### Error Logs
   
   2023/03/14 13:34:39 [error] 54#54: *30793151 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:36:09 [error] 54#54: *30826197 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:36:12 [warn] 54#54: *30845770 [lua] log-rotate.lua:238: rotate_file(): send USR1 signal to master process [1] for reopening log file, context: ngx.timer
   2023/03/14 13:37:39 [error] 54#54: *30860085 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:39:09 [error] 54#54: *30894877 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:40:39 [error] 54#54: *30929391 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:42:09 [error] 54#54: *30963047 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:43:39 [error] 54#54: *30996003 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:45:09 [error] 54#54: *31030835 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:46:39 [error] 54#54: *31066241 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:48:09 [error] 54#54: *31101705 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:49:39 [error] 54#54: *31135046 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:51:09 [error] 54#54: *31170350 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:52:28 [error] 47#47: *31221065 [lua] radixtree_sni.lua:146: match_and_set(): failed to find any SSL certificate by SNI: {ip}, context: ssl_certificate_by_lua*, client: 198.199.100.17, server: 0.0.0.0:443
   2023/03/14 13:52:30 [error] 48#48: *31221563 [lua] radixtree_sni.lua:146: match_and_set(): failed to find any SSL certificate by SNI: {ip}, context: ssl_certificate_by_lua*, client: 198.199.100.17, server: 0.0.0.0:443
   2023/03/14 13:52:30 [error] 48#48: *31221674 [lua] radixtree_sni.lua:146: match_and_set(): failed to find any SSL certificate by SNI: {ip}, context: ssl_certificate_by_lua*, client: 198.199.100.17, server: 0.0.0.0:443
   2023/03/14 13:52:31 [error] 48#48: *31221916 [lua] radixtree_sni.lua:146: match_and_set(): failed to find any SSL certificate by SNI: {ip}, context: ssl_certificate_by_lua*, client: 198.199.100.17, server: 0.0.0.0:443
   2023/03/14 13:52:31 [error] 49#49: *31222037 [lua] radixtree_sni.lua:146: match_and_set(): failed to find any SSL certificate by SNI: {ip}, context: ssl_certificate_by_lua*, client: 198.199.100.17, server: 0.0.0.0:443
   2023/03/14 13:52:39 [error] 54#54: *31204689 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:54:09 [error] 54#54: *31239892 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:55:39 [error] 54#54: *31274957 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:56:18 [error] 46#46: *31309989 [lua] init.lua:184: http_ssl_phase(): failed to fetch ssl config: failed to find SNI: please check if the client requests via IP or uses an outdated protocol. If you need to report an issue, provide a packet capture file of the TLS handshake., context: ssl_certificate_by_lua*, client: 125.77.156.177, server: 0.0.0.0:443
   2023/03/14 13:57:09 [error] 54#54: *31310514 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 13:58:39 [error] 54#54: *31343495 [lua] informer_factory.lua:310: watch failed, kind: Endpoints, reason: ReadBodyError, message : closed, context: ngx.timer
   2023/03/14 14:00:00 [warn] 54#54: *31397720 [lua] log-rotate.lua:238: rotate_file(): send USR1 signal to master process [1] for reopening log file, context: ngx.timer
   
   ### Steps to Reproduce
   
   configure:
   ```
   plugin_attr:
     prometheus:
       export_addr:
         ip: "0.0.0.0"
         port: 9091
     log-rotate:
       max_kept: 30
       max_size: 1000000000
   ```
   
   The number of log files is greater than 30. 
   <img width="596" alt="image" src="https://user-images.githubusercontent.com/10682145/224919111-26933496-d1d3-4069-8038-d7d9d4501c8c.png">
   
   
   ### Environment
   
   - APISIX version (run `apisix version`): 3.0.0
   - Operating system (run `uname -a`): 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux
   - OpenResty / Nginx version (run `openresty -V` or `nginx -V`):nginx version: openresty/1.21.4.1
   built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 
   built with OpenSSL 1.1.1n  15 Mar 2022
   TLS SNI support enabled
   configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DAPISIX_BASE_VER=1.21.4.1.3 -DNGX_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so -DNGX_HTTP_GRPC_CLI_ENGINE_PATH=/usr/local/openresty/libgrpc_engine.so -DNGX_LUA_ABORT_AT_PANIC -I/usr/local/openresty/zlib/include -I/usr/local/openresty/pcre/include -I/usr/local/openresty/openssl111/include' --add-module=../ngx_devel_kit-0.3.1 --add-module=../echo-nginx-module-0.62 --add-module=../xss-nginx-module-0.06 --add-module=../ngx_coolkit-0.2 --add-module=../set-misc-nginx-module-0.33 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.09 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.21 --add-module=../ngx_lua_upstream-0.07 --add-module=../headers-more-nginx-module-0.33 --add-module=../array-var-nginx-module-0.05 --add-module=../memc-nginx-module-0.19 --add-module=../redis2-nginx-module-0.15 --add-module=../redis-nginx-module-0.3.9 --ad
 d-module=../ngx_stream_lua-0.0.11 --with-ld-opt='-Wl,-rpath,/usr/local/openresty/luajit/lib -Wl,-rpath,/usr/local/openresty/wasmtime-c-api/lib -L/usr/local/openresty/zlib/lib -L/usr/local/openresty/pcre/lib -L/usr/local/openresty/openssl111/lib -Wl,-rpath,/usr/local/openresty/zlib/lib:/usr/local/openresty/pcre/lib:/usr/local/openresty/openssl111/lib' --add-module=/tmp/tmp.BZbTAq0pnL/openresty-1.21.4.1/../mod_dubbo-1.0.2 --add-module=/tmp/tmp.BZbTAq0pnL/openresty-1.21.4.1/../ngx_multi_upstream_module-1.1.1 --add-module=/tmp/tmp.BZbTAq0pnL/openresty-1.21.4.1/../apisix-nginx-module-1.11.0 --add-module=/tmp/tmp.BZbTAq0pnL/openresty-1.21.4.1/../apisix-nginx-module-1.11.0/src/stream --add-module=/tmp/tmp.BZbTAq0pnL/openresty-1.21.4.1/../apisix-nginx-module-1.11.0/src/meta --add-module=/tmp/tmp.BZbTAq0pnL/openresty-1.21.4.1/../wasm-nginx-module-0.6.4 --add-module=/tmp/tmp.BZbTAq0pnL/openresty-1.21.4.1/../lua-var-nginx-module-v0.5.3 --add-module=/tmp/tmp.BZbTAq0pnL/openresty-1.21.4.1/../grp
 c-client-nginx-module-v0.3.1 --with-poll_module --with-pcre-jit --with-stream --with-stream_ssl_module --with-stream_ssl_preread_module --with-http_v2_module --without-mail_pop3_module --without-mail_imap_module --without-mail_smtp_module --with-http_stub_status_module --with-http_realip_module --with-http_addition_module --with-http_auth_request_module --with-http_secure_link_module --with-http_random_index_module --with-http_gzip_static_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-threads --with-compat --with-stream --with-http_ssl_module
   - etcd version, if relevant (run `curl http://127.0.0.1:9090/v1/server_info`):{"id":"3847ad70-19a1-411b-be66-86a0a2014727","version":"3.0.0","etcd_version":"3.4.0","hostname":"logapisixgw-7bff4b8664-rkkvh","boot_time":1678631027}
   - APISIX Dashboard version, if relevant: 3.0.0
   - 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] monkeyDluffy6017 commented on issue #9061: bug: log-rotate max_kept doesn't work

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1582159215

   It's fixed by https://github.com/apache/apisix/pull/9619


-- 
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 #9061: bug: log-rotate max_kept doesn't work

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1469755613

   We have test cases to cover this and it does work , would you like to locate this problem in your environment?
   https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L260


-- 
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 #9061: bug: log-rotate max_kept doesn't work

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1470408501

   The `log_type` is very strange, have you ever changed the log's name in your code?
   https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L229


-- 
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] abs007 commented on issue #9061: bug: log-rotate max_kept doesn't work

Posted by "abs007 (via GitHub)" <gi...@apache.org>.
abs007 commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1483739687

   Hi, I'd like to work on this issue. It seems that the problem is that due to changing the log name, they aren't being deleted and the log size exceeds the `max_kept`.


-- 
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 closed issue #9061: bug: log-rotate max_kept doesn't work

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 closed issue #9061: bug: log-rotate max_kept doesn't work 
URL: https://github.com/apache/apisix/issues/9061


-- 
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] zsmlinux commented on issue #9061: bug: log-rotate max_kept doesn't work

Posted by "zsmlinux (via GitHub)" <gi...@apache.org>.
zsmlinux commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1470149964

   > We have test cases to cover this and it does work https://github.com/apache/apisix/blob/master/t/plugin/log-rotate2.t#L178
   > 
   > would you like to locate this problem in your environment? https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L260
   
   I am trying to get more logs such as:
   <img width="1122" alt="image" src="https://user-images.githubusercontent.com/10682145/225346529-e3a4490c-0460-4957-aef7-3ab56da6f4fa.png">
   
   
   And I found the `log_list` is nil:
   <img width="1438" alt="image" src="https://user-images.githubusercontent.com/10682145/225346947-9305df98-3b7b-4806-8121-22fc12b2ed00.png">
   
   That's why old logs can not be delete. 
   


-- 
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] spacewander commented on issue #9061: bug: log-rotate max_kept doesn't work

Posted by "spacewander (via GitHub)" <gi...@apache.org>.
spacewander commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1473007773

   LGTM


-- 
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] leslie-tsang commented on issue #9061: bug: log-rotate max_kept doesn't work

Posted by "leslie-tsang (via GitHub)" <gi...@apache.org>.
leslie-tsang commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1486114667

   > Hi, I'd like to work on this issue. It seems that the problem is that due to changing the log name, they aren't being deleted and the log size exceeds the `max_kept`.
   
   Assigned. tks.


-- 
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] zsmlinux commented on issue #9061: bug: log-rotate max_kept doesn't work

Posted by "zsmlinux (via GitHub)" <gi...@apache.org>.
zsmlinux commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1470240726

   <img width="904" alt="image" src="https://user-images.githubusercontent.com/10682145/225355918-44991391-682a-454c-ab88-0457f8e7de7c.png">
   
   logs:
   <img width="1307" alt="image" src="https://user-images.githubusercontent.com/10682145/225356932-ed86d680-cd6f-4677-8c36-c9fcd4b25ba9.png">
   
   `t` is nil , that's why `log_list` is nil.


-- 
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 #9061: bug: log-rotate max_kept doesn't work

Posted by "monkeyDluffy6017 (via GitHub)" <gi...@apache.org>.
monkeyDluffy6017 commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1471481475

   Custom named log files are currently not supported for deletion.
   https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L302
   
   Should we support now? @spacewander 


-- 
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] leslie-tsang commented on issue #9061: bug: log-rotate max_kept doesn't work

Posted by "leslie-tsang (via GitHub)" <gi...@apache.org>.
leslie-tsang commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1488945737

   > Does this line perform the log deletion? https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L260
   
   Yes.


-- 
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] zsmlinux commented on issue #9061: bug: log-rotate max_kept doesn't work

Posted by "zsmlinux (via GitHub)" <gi...@apache.org>.
zsmlinux commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1470995909

   > The `log_type` is very strange, have you ever changed the log's name in your code? https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L229
   
   
   I have change log's name in `config.yaml`:
   ```
   nginx_config:
       user: root
       error_log: /home/cc/log/service/docker_nginx_apisix_error.log
       http:
           access_log: /home/cc/log/service/apisix_apigateway_apisix_access.log
   ```


-- 
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] abs007 commented on issue #9061: bug: log-rotate max_kept doesn't work

Posted by "abs007 (via GitHub)" <gi...@apache.org>.
abs007 commented on issue #9061:
URL: https://github.com/apache/apisix/issues/9061#issuecomment-1488150034

   Does this line perform the log deletion?
   https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L260


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