[Linux] nginx记录多种响应时间

摘要:
官方网站介绍$request_time–完整请求时间,从NGINX读取客户端的第一个字节开始,到NGINX发送响应的最后一个字节结束$upstream_connect_time–时间戳建立与upstrea的连接

官网介绍
$request_time – Full request time, starting when NGINX reads the first byte from the client and ending when NGINX sends the last byte of the response body
$upstream_connect_time – Time spent establishing a connection with an upstream server
$upstream_header_time – Time between establishing a connection to an upstream server and receiving the first byte of the response header
$upstream_response_time – Time between establishing a connection to an upstream server and receiving the last byte of the response body


$upstream_connect_time 是建立连接的时间
$upstream_header_time 从建立连接到发送第一个响应头字节的时间
$request_times 是从请求到建立连接到发送完最后一个内容字节的时间
$upstream_response_time 是从建立连接到发送完最后一个内容字节的时间,这个是我们需要关注的,因为客户端的请求和客户所在网络有关

使用下面这个日志格式,看的参数比较全

log_format apm '[$time_local]	client=$remote_addr	'
               'request="$request"	 request_length=$request_length	'
               'http_referer="$http_referer"	'
               'bytes_sent=$bytes_sent	'
               'body_bytes_sent=$body_bytes_sent	'
               'user_agent="$http_user_agent"	'
               'upstream_addr=$upstream_addr	'
               'upstream_status=$upstream_status	'
               'cookie="$http_cookie"	'
               'request_body="$request_body"	'
               'document_root="$document_root"	'
               'fastcgi_script_name="$fastcgi_script_name"	'
               'request_filename="$request_filename"	'
               'request_time=$request_time	'
               'upstream_response_time=$upstream_response_time	'
               'upstream_connect_time=$upstream_connect_time	'
               'upstream_header_time=$upstream_header_time	';
[03/Dec/2019:19:18:43 +0800]    client=10.222.128.170   request="POST /wa.php?a=list_folder&calltype=auto HTTP/1.1"      request_length=959    http_referer="http://webmail.sina.net/classic/index.php" bytes_sent=630  body_bytes_sent=84      user_agent="Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36"      upstream_addr=127.0.0.1:9000    upstream_status=200     cookie="language=cn; __guid=253826190.3237372183145944600.1575355793588.1697; _ga=GA1.2.1940556535 mon=0; monitor_count=7"     request_body="sactioncount="    document_root="/usr/local/sinamail/web" fastcgi_script_name="/wa.php"  request_filename="/usr/local/sinamail/web/wa.php"        request_time=0.133      upstream_response_time=0.133    upstream_connect_time=0.000    upstream_header_time=0.133

免责声明:文章转载自《[Linux] nginx记录多种响应时间》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇toad 快捷键大全中国佛学66句震撼世界的禅语下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

为Nginx服务器配置黑(白)名单的防火墙

处在黑名单中的ip与网络,将无法访问web服务。 处在白名单中的ip,访问web服务时,将不受nginx所有安全模块的限制。 支持动态黑名单(需要与ngx_http_limit_req 配合) 具体详见下面的说明   文件配置方法说明   一、定义黑名单或白名单方法: 在Nginx的conf目录下面建立blockip.conf文件,把想要屏蔽的IP只要加...

nginx Access-Control-Allow-Origin 多域名跨域设置

2019-1-16 12:24:15 星期三 网站的静态文件(js, css, 图片, 字体等)是在一个单独的域名下的, 为了防止非法访问, 给nginx添加了跨域的控制, 也可以在PHP代码中添加 nginx指令: add header 1. 在location块中, 判断当前来源的域名($http_origin)是不是符合条件, 2. 符合条件的话就用...

nginx配置时server_name配的不一样还能正常访问

  原先server_name 配的是api.test.toutiao.applet.rockysaas.com,监听的是80端口,http。后来域名改成了api-test.tbk.rockysaas.com,监听443,https。但是发现原先的api.test.toutiao.applet.rockysaas.com还能访问。 server { #...

Nginx简介及环境搭建

什么是Nginx? Nginx是一款高性能的http 服务器/反向代理服务器及电子邮件(IMAP/POP3)代理服务器。由俄罗斯的程序设计师Igor Sysoev所开发,官方测试nginx能够支支撑5万并发链接,并且cpu、内存等资源消耗却非常低,运行非常稳定。本文主要简述Nginx的环境搭建步骤和注意事项,仅供学习分享使用,如有不足之处,还请指正。 Ng...

Nginx配置同一个域名http与https两种方式都可访问

##配置 http://test.pay.joyhj.com https://test.pay.joyhj.com 两者都可访问 # vim /usr/local/nginx/conf/vhost/test.pay.joyhj.com.confserver{   listen 80;   listen 443 ssl;  ##把ssl on;这行注释掉,...

运维配置环境中间件

日常Linux运维环境配置笔记---不定期更新 声明:本文为个人维护笔记,当中的例子或者步骤都是借鉴网络上的方法或者方案,后自己一步步的进行试验后得出来的。有可能会写错,也有可能是缺少某部分没有记录,如发现请大家指出。谢谢 版权声明:本文为博主原创文章,未经博主允许不得转载。 1.环境建立 输入用户、密码登录Luinx 查看网络情况如何,有没有加载网...