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/11/16 14:16:15 UTC
[GitHub] [apisix] JohnsonCaii opened a new issue, #8343: help request: log-rotate max_kept doesn't work if enable_compression: true
JohnsonCaii opened a new issue, #8343:
URL: https://github.com/apache/apisix/issues/8343
### Description
```
$ git clone https://github.com/apache/apisix-docker.git
$ cd apisix-docker/example
```
Update the `example/apisix_conf/config.yaml` to
```
plugins:
- log-rotate
plugin_attr:
prometheus:
export_addr:
ip: "0.0.0.0"
port: 9091
log-rotate:
interval: 1 # rotate interval (unit: second)
max_kept: 10 # max number of log files will be kept
max_size: -1 # max size of log files will be kept
enable_compression: true
```
Hi team. I want to keep only the X most recent tar.gz files while enable_compression: true, but the current configuration cannot take effect. Is this a bug or is it intentional?
If it is intentional, any suggestions that I can make it? Thanks in advance.
### 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] spacewander closed issue #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
spacewander closed issue #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
URL: https://github.com/apache/apisix/issues/8343
--
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 #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1319692239
OK, the `log-rotate` plugin can not clean the compressed log file now, would you like to fix this ? @JohnsonCaii
--
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 #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1319580469
> The .tar.gz suffix is hardcoded here.
I don't know what you mean '.tar.gz' suffix is hardcoded, the file compressed is renamed before (https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L227), and it's just add a suffix, it's full name likes: 2022-11-18_13-49-06__access.log.tar.gz
We have test case to check this: https://github.com/apache/apisix/blob/master/t/plugin/log-rotate2.t
--
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] JohnsonCaii commented on issue #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
JohnsonCaii commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1319586839
几个命令很容易复现,你试下吧
--
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] hf400159 commented on issue #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
hf400159 commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1319620377
I reproduced this problem~ I set to keep only 10 log files, but it didn't take effect.
![image](https://user-images.githubusercontent.com/97138894/202640518-11566db7-7dc1-4877-8c5d-621007f2995c.png)
cc @monkeyDluffy6017
--
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] JohnsonCaii commented on issue #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
JohnsonCaii commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1319711271
Sorry. I'm not familiar with Lua, maybe someone here can help to fix this issue?
--
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] JohnsonCaii commented on issue #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
JohnsonCaii commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1319570361
The logic is correct only if `enable_compression: false`. Please see my input here.
> https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L179 The `.tar.gz` suffix is hardcoded here.
>
> The code itself didn't check if compression was enabled when cleaning up old files here. https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L254
>
> In the very first code of this feature, it's correct. [05fc230#diff-cec78832f4c2b34965a93f89b98b12104e34868088ae2a1380973a94d43c0a8aR125](https://github.com/apache/apisix/commit/05fc2306b5f005799e908273cfe11bd5f830459f#diff-cec78832f4c2b34965a93f89b98b12104e34868088ae2a1380973a94d43c0a8aR125)
>
> Please have a check on it. Thanks
--
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] JohnsonCaii commented on issue #8343: help request: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
JohnsonCaii commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1318154548
https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L179
The `.tar.gz` suffix is hardcoded here.
The code itself didn't check if compression was enabled when cleaning up old files here.
https://github.com/apache/apisix/blob/master/apisix/plugins/log-rotate.lua#L254
In the very first code of this feature, it's correct.
https://github.com/apache/apisix/commit/05fc2306b5f005799e908273cfe11bd5f830459f#diff-cec78832f4c2b34965a93f89b98b12104e34868088ae2a1380973a94d43c0a8aR125
Please have a check on it. Thanks
--
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 #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1319507309
The logic is correct:
1. rename the old log file
2. open the new log file
3. compress the old log file
4. clean the oldest file
--
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 #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
monkeyDluffy6017 commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1319507521
I'll try to reproduce your 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] tzssangglass commented on issue #8343: help request: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
tzssangglass commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1317933871
Any error in the `logs/error.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] JohnsonCaii commented on issue #8343: help request: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
JohnsonCaii commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1317939058
> Any error in the `logs/error.log`?
Seems like no.
```
$ cat 2022-11-17_01-45-11__error.log
2022/11/17 01:45:10 [notice] 115#115: signal process started
2022/11/17 01:45:10 [warn] 50#50: *4 [lua] plugin.lua:200: load(): new plugins: {"log-rotate":true}, context: init_worker_by_lua*
2022/11/17 01:45:10 [warn] 51#51: *1 [lua] plugin.lua:200: load(): new plugins: {"log-rotate":true}, context: init_worker_by_lua*
2022/11/17 01:45:10 [warn] 50#50: *4 [lua] plugin.lua:250: load_stream(): new plugins: {"syslog":true,"mqtt-proxy":true,"limit-conn":true,"ip-restriction":true}, context: init_worker_by_lua*
2022/11/17 01:45:10 [warn] 47#47: *2 [lua] plugin.lua:200: load(): new plugins: {"log-rotate":true}, context: init_worker_by_lua*
2022/11/17 01:45:10 [warn] 47#47: *2 [lua] plugin.lua:250: load_stream(): new plugins: {"syslog":true,"mqtt-proxy":true,"limit-conn":true,"ip-restriction":true}, context: init_worker_by_lua*
2022/11/17 01:45:10 [warn] 51#51: *1 [lua] plugin.lua:250: load_stream(): new plugins: {"syslog":true,"mqtt-proxy":true,"limit-conn":true,"ip-restriction":true}, context: init_worker_by_lua*
2022/11/17 01:45:10 [warn] 49#49: *5 [lua] plugin.lua:200: load(): new plugins: {"log-rotate":true}, context: init_worker_by_lua*
2022/11/17 01:45:10 [warn] 48#48: *3 [lua] plugin.lua:200: load(): new plugins: {"log-rotate":true}, context: init_worker_by_lua*
2022/11/17 01:45:10 [warn] 49#49: *5 [lua] plugin.lua:250: load_stream(): new plugins: {"syslog":true,"mqtt-proxy":true,"limit-conn":true,"ip-restriction":true}, context: init_worker_by_lua*
2022/11/17 01:45:10 [warn] 48#48: *3 [lua] plugin.lua:250: load_stream(): new plugins: {"syslog":true,"mqtt-proxy":true,"limit-conn":true,"ip-restriction":true}, context: init_worker_by_lua*
2022/11/17 01:45:11 [warn] 51#51: *161 [lua] log-rotate.lua:238: rotate_file(): send USR1 signal to master process [1] for reopening log file, context: ngx.timer
```
--
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] JohnsonCaii commented on issue #8343: bug: log-rotate max_kept doesn't work if enable_compression: true
Posted by GitBox <gi...@apache.org>.
JohnsonCaii commented on issue #8343:
URL: https://github.com/apache/apisix/issues/8343#issuecomment-1319715566
And it would be great if `log-rotate` plugin have the `gzip` compress support since the .gz file can be viewed with the native commands like `grep` and `less`.
--
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