前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >[Linux] nginx记录多种响应时间

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

作者头像
唯一Chat
发布2019-12-10 16:32:32
3.4K0
发布2019-12-10 16:32:32
举报
文章被收录于专栏:陶士涵的菜地陶士涵的菜地

官网介绍 $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 是从建立连接到发送完最后一个内容字节的时间,这个是我们需要关注的,因为客户端的请求和客户所在网络有关

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

代码语言:javascript
复制
log_format apm '[$time_local]\tclient=$remote_addr\t'
               'request="$request"\t request_length=$request_length\t'
               'http_referer="$http_referer"\t'
               'bytes_sent=$bytes_sent\t'
               'body_bytes_sent=$body_bytes_sent\t'
               'user_agent="$http_user_agent"\t'
               'upstream_addr=$upstream_addr\t'
               'upstream_status=$upstream_status\t'
               'cookie="$http_cookie"\t'
               'request_body="$request_body"\t'
               'document_root="$document_root"\t'
               'fastcgi_script_name="$fastcgi_script_name"\t'
               'request_filename="$request_filename"\t'
               'request_time=$request_time\t'
               'upstream_response_time=$upstream_response_time\t'
               'upstream_connect_time=$upstream_connect_time\t'
               'upstream_header_time=$upstream_header_time\t';
代码语言:javascript
复制
[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
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-12-03 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档