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

官网介绍
$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]\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‘;
[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

原文地址:https://www.cnblogs.com/taoshihan/p/11978842.html

时间: 2024-08-30 11:51:22

[Linux] nginx记录多种响应时间的相关文章

Linux之DNS多种服务搭建

一:什么是DNS为什么会有DNS 域名系统(英文:Domain Name System,缩写:DNS)是因特网的一项服务.在互联网诞生的早起因接入互联网的主机数量非常少,当时没有专用的DNS服务器来对整个互联网的域名进行解析,当时只在我们主机的host文件里记录了各个主机和IP对应的关系,他们每隔一定时间进行一次数据更新,但是后来接入互联网主机越来越多,以至于host文件里记录的数据太多,当在需要访问一个主机时查询host文件将是一个很浪费主机资源(不但有CPU还有巨大的内存资源)事情,所以人们

[nginx]linux nginx 安装

linux nginx 安装 作者:flymaster qq:908601287 blog:http://www.cnblogs.com/flymaster500/ 1.第一种安装:编译安装 编译安装NGINX 1. 查看安装系统环境[[email protected] ~]# cat /etc/redhat-releaseCentOS release 6.7 (Final)[[email protected] ~]# uname -r2.6.32-573.el6.x86_64[[email p

LNMP环境搭建(linux+Nginx + Mysql + PHP)

linux+Nginx + Mysql + PHP 搭配可以说目前使用比较广泛那要想在这台刚安装好系统的服务器上配置这环境,有多种方式 一.傻瓜式一键安装 为了让大家安装环境能简单,方便.有人把它们集成了一个包. 1.LNMP一键安装包网址:lnmp.org,里面介绍一些要求,功能等进入到安装页面说明,找到相关的安装说明,运行,然后一步一步按照操作就行了,比较简单 2.使用宝塔,这是更加傻瓜,方便的一款工具,操作服务,只需在网站后台,点点鼠标,就能完成网址:bt.cn找到,linux安装,里面有

centos6 LNMP的搭建(linux+nginx+mysql+php)

LNMP的搭建(linux+nginx+mysql+php) 简介 LNMP代表的就是:Linux系统下Nginx+MySQL+PHP网站服务器架构. Linux是一类Unix计算机操作系统的统称,是目前最流行的免费操作系统.代表版本有:debian.centos.ubuntu.fedora.gentoo等. Nginx是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器. Mysql是一个小型关系型数据库管理系统. PHP是一种在服务器端执行的嵌入HTML文档

Linux nginx日志按天分割实例

Linux nginx日志按天分割实例 nginx的日志有个小缺点,日志文件一直就是一个,不会自动地进行切割,如果访问量很大的话,将导致日志文件非常大,不便于管理 这就需要我们自己来实现了,按日期每天生产一个日志文件 思路 每天零点把默认日志文件改名为当天日期,再重新打开新的日志文件 使用定时任务来执行脚本,脚本中执行改名和重新打开日志文件的操作 向Nginx主进程发送 USR1 信号,就可以重新打开日志文件 实现 #/bin/bash #备份日志的路径bakpath='/home/nginx/

How To Install Linux, nginx, MySQL, PHP (LEMP) stack on CentOS 6

About Lemp LEMP stack is a group of open source software to get web servers up and running. The acronym stands for Linux, nginx (pronounced Engine x), MySQL, and PHP. Since the server is already running CentOS, the linux part is taken care of. Here i

LAMP架构演进到LAMPGC,再演进到LNMLGC(linux+nginx+mysql+lua+gearman+C)

LAMP是一个大众的架构了,linux+apache+mysql+php 在我们系统的架构中,做了进一步的演进,linux+apahce+mysql+php+gearman+C php作页面的展示 核心业务逻辑由C语言实现,php通过gearman中间件调用C任务 由于apache在高并发方面不太给力,因此在需要高并发的场景中,我们进一步演进,linux+nginx+mysql+php+lua+gearman+C 页面部分由nginx+fastcgi+php-fpm来展示 高并发的业务调用由ng

centos7安装Lnmp(Linux+Nginx+MySql+Php+phpMyAdmin+Apache)

centos7安装Lnmp(Linux+Nginx+MySql+Php)及Apache Nginx是俄罗斯人编写的十分轻量级的HTTP服务器,Nginx是一个高性能的HTTP和反向代理服务器,Nginx 超越 Apache 的高性能和稳定性,使得国内使用 Nginx 作为 Web 服务器的网站也越来越多, 我们学习PHP,以及搭建我们自己的LNMP环境,不妨先在本机上尝试学习,下面我们一步一步来完成在CentOS7 下安装LNMP(Linux+Nginx+MySQL+PHP)及Apache. 查

Linux+Nginx+Asp.net Core

Linux+Nginx+Asp.net Core 上篇<Docker基础入门及示例>文章介绍了Docker部署,以及相关.net core 的打包示例.这篇文章我将以oss.offical.site站点为例,主要介绍下在linux机器下完整的部署流程,.net core在docker容器中的运行已经介绍,这里.net core运行环境我会介绍直接在linux运行的场景,内容主要包含以下几个部分: 1. 基础工具和Linux环境准备 2. .Net Core环境安装及端口配置 3. Nginx的