access日志执行的阶段在log阶段,是11个阶段中的最后一个阶段,由ngx_http_log_module模块提供,默认是被编译进nginx中的,不能禁用。
一、指令
1、log_format
log_format指令的用法为log_format name [escape=default|json|none] string ....。
默认格式为log_format combined '...',默认的值为:
log_format combined '$remote_addr - $remote-user [$time_local]''"$request" $status $body_bytes_sent' '"$http_referer" "$http_user_agent"'
存在的上下文为http。这里的escape是定义日志的分割符或者日志格式的。
2、access_log
配置日志文件路径,用法为
access_log path [format [buffer=size] [gzip[=level]] [flush=time] [if=condition]]