文章目录
- 记录请求访问日志的 log 模块
- access 日志格式
- 配置日志文件路径
- 对日志文件包含变量时的优化
记录请求访问日志的 log 模块
- 此模块无法禁用
- 功能: 将http 请求相关信息记录到日志;
- 模块: ngx_http_log_module, 无法禁用
access 日志格式
-
log_format
:
- syntax: log_format name [escape=default|json|none] string …;
- default: log_format combined “…”;
- context: http
-
默认的 combined 日志格式:
log_format combined '$remote_addr -$remote_user [$time_local]' '"$request" $status $body_bytes_sent' '"http_referer" "$http_user_angent"'<