In many nginx config tutorials I see this:

access_log /var/log/nginx/access.log main

What is main? It is not found in the docs.


1 Answer 1


The second parameter of the access_log directive is an optional format name, which determines the content of a log file entry.

The default format is combined, which is predefined as:

log_format combined '$remote_addr - $remote_user [$time_local] '
                    '"$request" $status $body_bytes_sent '
                    '"$http_referer" "$http_user_agent"';

See this document for details.

The format named main should be defined by a log_format directive elsewhere in your Nginx configuration. Use the command nginx -T (with an uppercase T) to view the entire Nginx configuration across all included files.

You must log in to answer this question.

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