log_format指令用来设置日志的记录格式,它的语法如下: log_format name format{format...}其中name表示定义的格式名称,format表示定义的格式样式。 log_format有一个默认的、无须设置的combined日志格式设置,相当于Apache的combined日志格式,其具体参数如下: log_format combined'$remote_addr-$remote_user [$time_loca...
默认的日志格式如下(默认是注解掉的,系统也自动会使用): #log_format main'$remote_addr - $remote_user [$time_local] "$request"'#'$status $body_bytes_sent "$http_referer"'#'"$http_user_agent" "$http_x_forwarded_for"'; #access_log logs/access.log main; 二、我使用的日志格式 我仅仅在...
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; 我们看到默认的格式,基本都是单引号 '' 包裹着一些变量,还包括 中划线 - ...
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $boby_bytes_sent "http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; 1. 2. 3. 上面的这个默认格式:其中,log_format为日志格式的关键参数,不能变,main 是为日志格式指定的标签,记录日志时通过...
nginx 服务器日志相关指令主要有两条,一条是log_format,用来设置日志格式,另外一条是access_log,用来指定日志文件的存放路径、格式和缓存大小,一般在 nginx 的配置文件中日记配置(/usr/local/nginx/conf/nginx.conf)。
下面是默认的nginx日志格式: log_format main '$remote_addr - $remote_user [$time_local]"$request" ' '$status $body_bytes_sent"$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; 字段含义: $remote_addr远程客户端的IP地址。
[nginx]log_format用法详解 log_format 语法:log_format format_name format 上下文:rtmp 描述:创建指定的日志格式。日志格式看起来很像 nginx HTTP 日志格式。日志格式里支持的几个变量有: * connection - 连接数。 * remote_addr - 客户端地址。 * app - application 名。
语法格式: log_format name [escape=default|json] string ...; 默认值 : log_format combined "..."; 作用域 : http 实例一: log_format compression '$remote_addr - $remote_user [$time_local] ' '"$request" $status $bytes_sent '