Stream log directives

log_format (stream)

stream context; sets session log format.

Formal Syntax & Structure

nginx syntaxnginx
log_format name [escape=default|json|none] string ...;

Parameters & Attributes

NameTypeDescription
nameidentifierName a session log format.
escapeescape=default | escape=json | escape=noneSelect variable escaping; JSON escaping does not itself construct valid JSON.
formatone or more stringsLog template containing literal text and variables; avoid sensitive data.

Working Example

Example Snippetnginx
log_format session "$protocol $status $session_time";
Nginx Reference