Is it possible to specify custom error log format on Nginx?

后端 未结 3 2200
悲&欢浪女
悲&欢浪女 2021-01-01 10:39

I can specify custom log format for access_log on Nginx, but it doesn\'t work for error_log.

Is there anyway to achieve this?

3条回答
  •  盖世英雄少女心
    2021-01-01 11:13

    A dirty trick I used when I wanted to change the format of the nginx error log (in this case when sending my own logs with openresty's ngx.log method from Lua) was to prefix my own log message with enough \b (backspace) characters to delete all the information I wasn't interested in viewing when running a tail -f error.log.

提交回复
热议问题