Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: log-rotate.lua #5663

Closed
saintak opened this issue Dec 1, 2021 · 2 comments · Fixed by #5715
Closed

bug: log-rotate.lua #5663

saintak opened this issue Dec 1, 2021 · 2 comments · Fixed by #5715

Comments

@saintak
Copy link

saintak commented Dec 1, 2021

Issue description

1.log-rotate 每次会操作之前一次的文件,下图为我设置为两分钟一切割,开启压缩的情况。
微信图片_20211201213111

2.用tar做压缩不合适,最好是改成"gzip filename",不仅不需要删除源文件,而且less filename.gz可以直接读取文件内容,方便大数据分
3.如 #5658 所述,开启log-rotate之后,没有log了

Environment

  • apisix version (cmd: apisix version):2.11.0

  • OS (cmd: uname -a):Linux apisix-test 3.10.0-1160.15.2.el7.x86_64 change: added doc of how to load plugin. #1 SMP Wed Feb 3 15:06:38 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

  • OpenResty / Nginx version (cmd: nginx -V or openresty -V):nginx version: openresty/1.19.3.2
    built by gcc 9.3.1 20200408 (Red Hat 9.3.1-2) (GCC)
    built with OpenSSL 1.1.1l 24 Aug 2021
    TLS SNI support enabled
    configure arguments: --prefix=/usr/local/openresty/nginx --with-cc-opt='-O2 -DAPISIX_BASE_VER=1.19.3.2.2 -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.32 --add-module=../form-input-nginx-module-0.12 --add-module=../encrypted-session-nginx-module-0.08 --add-module=../srcache-nginx-module-0.32 --add-module=../ngx_lua-0.10.19 --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.7 --add-module=../ngx_stream_lua-0.0.9 --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.wRcqhSzQQC/openresty-1.19.3.2/../mod_dubbo --add-module=/tmp/tmp.wRcqhSzQQC/openresty-1.19.3.2/../ngx_multi_upstream_module --add-module=/tmp/tmp.wRcqhSzQQC/openresty-1.19.3.2/../apisix-nginx-module --add-module=/tmp/tmp.wRcqhSzQQC/openresty-1.19.3.2/../wasm-nginx-module --add-module=/tmp/tmp.wRcqhSzQQC/openresty-1.19.3.2/../lua-var-nginx-module --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 have (cmd: run curl http://127.0.0.1:9090/v1/server_info to get the info from server-info API):

  • apisix-dashboard version, if have:

  • the plugin runner version, if the issue is about a plugin runner (cmd: depended on the kind of runner):

  • luarocks version, if the issue is about installation (cmd: luarocks --version):/usr/bin/luarocks 2.3.0
    LuaRocks main command-line interface

Steps to reproduce

plugins:
# the plugins you enabled
- log-rotate
#
plugin_attr:
log-rotate:
interval: 120 # rotate interval (unit: second)
max_kept: 6 # max number of log files will be kept
enable_compression: true # enable log file compression(gzip) or not, default false

Actual result

1.可能会造成日志丢失
2.tar.gz不方便进一步进行大数据运算

Error log

null

Expected result

1.修复压缩的bug
2.最好将tar改为gzip

@besich
Copy link
Contributor

besich commented Dec 3, 2021

you can try disable compression option, i think it can solve the problem of lost logs.
I will verify whether it is caused by compression. If so, I want to try to repair it

@saintak
Copy link
Author

saintak commented Dec 6, 2021

#5658 是相同的问题,等待修复中。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants