cloudflare / lua-resty-logger-socket

Raw-socket-based Logger Library for Nginx (based on ngx_lua)
488 stars 130 forks source link

what's the best effective way to collect log in nginx lua #33

Closed JoyChou93 closed 6 years ago

JoyChou93 commented 7 years ago

we can use

so, which one or other way is the best ?

calio commented 7 years ago

ngx.log is fine, it's the standard way of logging. Do not use iopen to write files from Lua code as it will block current Nginx worker process and cause performance issue. socket is also good if you have a service that collects logs remotely. Otherwise, just use ngx.log.

JoyChou93 commented 7 years ago

@calio But ngx.log has a limit of 2048 bytes. https://github.com/openresty/lua-nginx-module#ngxlog

calio commented 7 years ago

@JoyChou93 no matter which way to choose, there is always some kind of limit. If you know 2048 bytes limit is a problem, then switch to other ways.