提取模式选择“Nginx 日志模板”,填写 Nginx 配置文件(通常为 /etc/nginx/nginx.conf 或 /usr/local/nginx/conf/nginx.conf)中的日志模板,通常以 log_format 开头,例如: log_format main'$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$htt...
'$status $request_time $upstream_response_time $request_length $bytes_sent $body_bytes_sent $gzip_ratio $connection_requests "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log logs/nginx-access.log main; 说明:如下,有时候我们可以把日志配置json串格式,方便其它程序使...
request_length:请求大小 body_bytes_sent:返回的大小 http_referrer:来源页 http_user_agent:客户端名称 request_time:整体请求延时 1)统计日志中访问最多的10个IP 思路:因为remote_addr代表的客户端ip,所以取第一列就好了,并且去重,输出次数就ok了 方法1:awk '{a[$1]++}END{for(i in a) print a[i],...
例如:\x0A\xE0B\x0E $body_bytes_sent 表示在向客户端发送的http响应中,包体部分的字节数 $content_length 表示客户端请求头部中的Content-Length 字段 $content_type 表示客户端请求头部中的Content-Type 字段 $cookie_COOKIE 表示在客户端请求头部中的cookie 字段 $document_root 表示当前请求所使用的root 配...
#$body_bytes_sent(响应客户端内容字节数) #"$http_referer" '(记录用户从哪个链接跳转过来的) #'"$http_user_agent"(用户所使用的代理,一般都来自浏览器) #"$http_x_forwarded_for"'(通过代理服务器来记录客户端的IP); #记录用户的每一次请求,每一次请求都能在这个日志里面查找 ...
要分析Nginx日志并统计每个URL的访问内容总大小(使用$body_bytes_sent字段),你可以使用Unix/Linux命令行工具如awk来处理Nginx的访问日志文件。以下是一个使用awk的基本步骤,这将帮助你计算每个URL的总内容大小。 步骤 使用awk提取URL和发送的字节数:从Nginx日志中提取每一行的URL(通常是$7字段)和发送的字节数($body...
变量描述示例 $body_bytes_sent发送给客户端文件主体内容大小73 $connection_requestsTCP连接当前的请求数量1 $content_type"Content-Type" 请求头字段application/x-www-form-urlencoded; charset=UTF-8 $host服务器名,请求来源的域名tset.abc.com $http_referer记录从那个页面链接访问过来的https://tset1.abc.com...
日志功能在ngx_http_log_module模块中定义,实现了以指定格式写入请求日志。 我们先来看一个nginx配置文件: http{includemime.types;default_typeapplication/octet-stream;log_formatcustom'$remote_addr-$remote_user[$time_local]"$request"''$status$body_bytes_sent"$http_referer"''"$http_user_agent""$http...
'$status $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; 我们使用log_format指令定义了一个main的格式,并在access_log指令中引用了它。假如客户端有发起请求:https://suyunfe.com/,我们看一下我截取的一个请求的日志记录: ...
1、nginx默认日志格式 Nginx预定义了名为combined日志格式,如果没有明确指定日志格式默认使用该格式: 代码语言:javascript 代码运行次数:0 复制 Cloud Studio代码运行 log_format combined'$remote_addr - $remote_user [$time_local] ''"$request" $status $body_bytes_sent ''"$http_referer" "$http_user_age...