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

tjeden picture tjeden · Nov 22, 2010 · Viewed 29.2k times · Source

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?

Answer

CyberDem0n picture CyberDem0n · Nov 26, 2010

You can't specify your own format, but in nginx build-in several level's of error_log-ing.

Syntax: error_log file [ debug | info | notice | warn | error | crit ]

Default: ${prefix}/logs/error.log

Specifies the file where server (and fastcgi) errors are logged.

Default values for the error level:

  1. in the main section - error
  2. in the HTTP section - crit
  3. in the server section - crit

In my error_log, time always presented int begin of each error string in log.