apisix
apisix copied to clipboard
bug: log-rotate plugin should not rotate the access log when the enable_access_log setting is set to false
Current Behavior
The log-rotate plugin rotates the access log regardless of the enable_access_log setting.
Expected Behavior
The log-rotate plugin should skip rotating the access log if enable_access_log is set to false.
Error Logs
2024/05/31 09:41:48 [error] 57#57: *428 [lua] log-rotate.lua:150: rename_file(): move file from /usr/local/apisix/logs/access.log to /usr/local/apisix/logs//2024-05-31_09-41-48__access.log res:nil msg:/usr/local/apisix/logs/access.log: No such file or directory, context: ngx.timer
Steps to Reproduce
- Add the Configuration to config.yaml
nginx_config:
http:
enable_access_log: false
plugins:
- log-rotate
plugin_attr:
log-rotate:
interval: 1
- Mount config.yaml and run APISIX via the docker image
- Check the error log
Environment
- APISIX version (run
apisix version): 3.9.0
Verified with the latest code and it does have this problem.
Verified with the latest code and it does have this problem.
I will reopen the PR.