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?
The syntax for configuring a log format is: log_format format_name 'set_of_variables_to_define_format'; and the syntax for configuring access log is: access_log /path/to/log_file format_name; #simplest form OR access_log /path/to/log_file [format [buffer=size] [gzip[=level]] [flush=time] [if=condition]];
Syntax of error_log in Nginx: For configuring the error_log, you have to add the path of the log file and set the log level. If you do not set the second parameter, then the error_log will take “error” as its default log level: error_log /var/log/nginx/error.
The default log format in nginx is called "combined".
NGINX writes information about encountered issues of different severity levels to the error log. The error_log directive sets up logging to a particular file, stderr , or syslog and specifies the minimal severity level of messages to log. By default, the error log is located at logs/error.
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:
In my error_log, time always presented int begin of each error string in log.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With