apisix
apisix copied to clipboard
bug: log-rotate切割丢失文件
Current Behavior
测试环境中开启log-rotate插件,配置如下:
plugin_attr:
log-rotate:
interval: 21600 # rotate interval (unit: second)
max_kept: 20 # max number of log files will be kept
enable_compression: false # enable log file compression(gzip) or not, default false
观察几天后发现丢失了一份文件,如下:
猜测是否与实例重启有关,查看重启时间为15点19分,但丢失的文件应该是14点的,再查看其他机器实例,如下:
同样是15点19分重启过的但是没有丢失文件。
该问题是在交流群中有人反馈出现丢失文件问题后,我在自己的测试环境持续测试中发现的
Expected Behavior
No response
Error Logs
No response
Steps to Reproduce
1.启动apisix实例并开启log-rotate插件,每6小时切割生成一份日志文件,最多保存20份 2.启动测试程序,每分钟执行一定的调用,观察access.log文件可以正确记录日志 3.持续观察每日切割的文件
Environment
- APISIX version (run
apisix version
):2.14.1 - Operating system (run
uname -a
):3.10.0-957.27.2.el7.x86_64 #1 SMP Mon Jul 29 17:46:05 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux - OpenResty / Nginx version (run
openresty -V
ornginx -V
):1.21.4.1 - etcd version, if relevant (run
curl http://127.0.0.1:9090/v1/server_info
):3.5.0
It is strange, if there is a problem with the log-rotate plugin, all instances should lose log files.
Is there a timed task on the instance that will clean up log files larger than xx size?
我具体查看了下日志,可能是我这边停了一段时间测试程序,没有生成14的日志问题我再跟踪下
对比了一下3台测试机器,确实从13点45-15点20压测程序可能停了没有日志,但是另外两台机器会生成14点的日志文件并将8-14点的数据写入14点的文件,这台出问题的机器却将8-20点的数据一起写入了20点的文件中,请教下这个会跟什么有关系
It seems to be reproducible on this machine, and you can summarize the configuration on this machine into reproducible steps so that I can reproduce it locally to me.
This issue has been marked as stale due to 350 days of inactivity. It will be closed in 2 weeks if no further activity occurs. If this issue is still relevant, please simply write any comment. Even if closed, you can still revive the issue at any time or discuss it on the [email protected] list. Thank you for your contributions.
This issue has been closed due to lack of activity. If you think that is incorrect, or the issue requires additional review, you can revive the issue at any time.