nginx log format

参数 说明 示例
$remote_addr 客户端地址 211.28.65.253
$remote_user 客户端用户名称 --
$time_local 访问时间和时区 18/Jul/2012:17:00:01 +0800
$request 请求的URI和HTTP协议 "GET /article-10000.html HTTP/1.1"
$http_host 请求地址,即浏览器中你输入的地址(IP或域名) www.it300.com
192.168.100.100
$status HTTP请求状态 200
$upstream_status upstream状态 200
$body_bytes_sent 发送给客户端文件内容大小 1547
$http_referer url跳转来源 https://www.baidu.com/
$http_user_agent 用户终端浏览器等信息 "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; SV1; GTB7.0; .NET4.0C;
$ssl_protocol SSL协议版本 TLSv1
$ssl_cipher 交换数据中的算法 RC4-SHA
$upstream_addr 后台upstream的地址,即真正提供服务的主机地址 10.10.10.100:80
$request_time/request_time_msec/request_time_usec 整个请求的总时间 0.205
$upstream_response_time 请求过程中,upstream响应时间 0.002
$msec 日志写入时间 单位为秒,精度是毫秒。
时间: 2024-08-28 03:32:49

nginx log format的相关文章

Nginx报错nginx: [emerg] unknown log format "main"

故障描述: 在添加Nginx的子配置文件后报错误nginx: [emerg] unknown log format "main" 无法重新加载,仔细查看配置没有语法错误经过调试才发现是定义log_format的时候写到HTTP模块最下面,导致子配置文件无法识别. 错误的写法   include /opt/app/nginx/conf/conf.d/*.conf;   log_format  main  '$remote_addr - $remote_user [$time_local]

nginxのerror_logはformat指定できない.

備忘録です. http://toshitanian.hatenablog.com/entry/2013/10/25/023838 2013-10-25 nginxのerror_logはformat指定できない. nginxとかsupervisorとかDBのログをfluentdで一括管理したいなぁとおもったので,とりあえず 参考 にしたがって,nginxのログをltsv形式にしてみようとしたわけです. 環境は ubuntu server 12.04 LTS nginx 1.4.3 怒られる ngi

微信商城 Common Log Format Apache CustomLog

w 0- 180.153.206.16 - - [06/Apr/2017:06:36:26 +0800] "GET /rockmongo HTTP/1.1" 200 203 "-" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36" 101.226.79.182 - - [06

Nginx Log日志统计分析常用命令

IP相关统计 统计IP访问量(独立ip访问数量) awk '{print $1}' access.log | sort -n | uniq | wc -l 查看某一时间段的IP访问量(4-5点) grep "07/Apr/2017:0[4-5]" access.log | awk '{print $1}' | sort | uniq -c| sort -nr | wc -l 查看访问最频繁的前100个IP awk '{print $1}' access.log | sort -n |u

nginx log打印自定义头

一.客户端自定义头 如果客户端自定义了一个头.curl -H "wanwan: nihao1111" 192.168.1.192:8888,那么nginx服务端是怎么显示的呢?nginx.conf配置文件log_format添加$http_wanwan(此时的wanwan就是客户端添加的头信息) 二.举例说明 1.主配置 #vim /usr/local/nginx/conf/nginx.conf     log_format  access  '$remote_addr - $remo

nginx log 敏感信息过滤

有时我们会通过url传递一些敏感信息如token等,同时又不希望这些信息被记录在nginx的log(可能会分发给数据处理或解决bug的人)里. 这时需要过滤url.具体方法如下 http{ log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' '"$http_user_agent&

nginx log记录请求的头信息

记录访问的log,为了在出现特殊情况时,方便检查出现问题的地方.log_format accesslog ‘$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 accesslog;记录下,用户ip,

基于Storm的Nginx log实时监控系统

背景 UAE(UC App Engine)是一个UC内部的PaaS平台,总体架构有点类似CloudFoundry,包括: 快速部署:支持Node.js.Play!.PHP等框架 信息透明:运维过程.系统状态.业务状况 灰度试错:IP灰度.地域灰度 基础服务:key-value存储.MySQL高可用.图片平台等 这里它不是主角,不作详细介绍. 有数百个Web应用运行在UAE上,所有的请求都会经过UAE的路由,每天的Nginx access log大小是TB级,如何实时监控每个业务的访问趋势.广告数

pytest demo and log format

import pytest import allure import sys,os import logging import datetime def logInit(): now_time = datetime.datetime.now() filePath = os.getcwd() + "\\log\\" if os.path.exists(filePath) is False: os.makedirs(filePath) logFile = filePath + now_ti