openresty / lua-nginx-module

Embed the Power of Lua into NGINX HTTP servers
https://openresty.org/
11.34k stars 2.03k forks source link

How to custom error_log? #1767

Open snpcp opened 4 years ago

snpcp commented 4 years ago

Hi, This is current nginx's log: 2020/08/14 15:01:53 [notice] 25842#25842: *14080 [lua] xxx.lua:11: xx: message, client: xxx, server: xxx

However, I want to change it to that: 2020/08/14 15:01:53 [notice] message

Could you tell me how do it? Thanks!

codjust commented 4 years ago

https://github.com/openresty/lua-resty-core/blob/master/lib/ngx/errlog.md#raw_log this?

snpcp commented 4 years ago

Thanks you for tell me.

The row_log will print to '2020/08/14 15:01:53 [notice] 25842#25842: *14080 xx: message, client: xxx, server: xxx'. that's pretty good, but can I delete 'client:xxx, server:xxx' and 'context: ngx.timer'? the best thing is that I can customize ngx.log().