HTTP directives

access_log directive (HTTP)

Selects request log destination and options. Default: logs/access.log combined. Context: http, server, location, if in location, limit_except. Logs may contain sensitive metadata; keep them private.

Formal Syntax & Structure

nginx syntaxnginx
access_log path [format [buffer=size] [gzip[=level]] [flush=time] [if=condition]];access_log off;

Parameters & Attributes

NameTypeDescription
pathstringLog destination, e.g. lab-relative path.
formatstringNamed log format; combined if omitted.
buffersizeOptional buffer size.
gzipinteger or flagOptional compressed writes; requires zlib support.
flushtimeOptional buffer flush interval.
ifexpressionOptional logging condition.

Working Example

Example Snippetnginx
access_log logs/access.log;
Nginx Reference