Nginx error log log_format variables

nginx

I want to specify log format for nginx error logs, but I could not find any variable for errors.
I found required variables for access logs like below:

log_format test'$remote_addr - $remote_user [$time_local] '
                       '"$request" $status $bytes_sent '
                       '"$http_referer" "$http_user_agent" "$gzip_ratio"';

Is there any $error, $error_body or something like this that could be matched for errors?

Best Answer

No, $status is the one you want. It contains both erroneous and successful statuses. You should grep the access_log for statuses indicating the errors and the error_log for their causes. I guess you're misunderstanding the concept of access and error log separation.

Related Topic