Nginx – php-fpm error logging with nginx

loggingnginxphp-fpm

I have nginx+php-fpm on a server and the messages get truncated at 2048 chars, rendering the message quite unhelpful when a stack trace is logged : I can't see the following fields anymore:

  • host (not interesting)
  • upstream (not interesting)
  • request (very very interesting)
  • server (not interesting)
  • client (not interesting, always 127.0.0.1 because of our architecture)

How do you overcome this problem? Do you change the format? Or did you find a way to overcome this stupid 2048 chars limitation which I hear is hardcoded? Or to disable this backtrace?

Best Answer

It’s really hardcoded, you would have to edit the source file and compile nginx yourself. Have a look at the following file from the nginx source repository: http://trac.nginx.org/nginx/browser/nginx/trunk/src/core/ngx_log.h#L67

#define NGX_MAX_ERROR_STR   2048

Increase it to what suites your needs.