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
| Name | Type | Description |
|---|---|---|
| path | string | Log destination, e.g. lab-relative path. |
| format | string | Named log format; combined if omitted. |
| buffer | size | Optional buffer size. |
| gzip | integer or flag | Optional compressed writes; requires zlib support. |
| flush | time | Optional buffer flush interval. |
| if | expression | Optional logging condition. |
Working Example
Example Snippetnginx
access_log logs/access.log;