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?

  • What do you mean by «errors»?
    – Alexey Ten
    Feb 18, 2015 at 12:19

1 Answer 1


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.

  • No i know the differences but I'm trying to specify a format for it .
    – max imax
    Feb 17, 2015 at 12:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .