统计web 访问日志的请求数据
tomcat日志格式 在配置文件 server.xml 中,具体参照官方文档 https://tomcat.apache.org/tomcat-8.0-doc/config/valve.html#Access_Log_Valve
pattern |
A formatting layout identifying the various information fields from the request and response to be logged, or the word |
- %a - Remote IP address 远端IP
- %A - Local IP address 本地IP
- %b - Bytes sent, excluding HTTP headers, or '-' if zero 发送字节数
- %B - Bytes sent, excluding HTTP headers 发送字节数
- %h - Remote host name (or IP address if
enableLookupsfor the connector is false) 远端主机名 - %H - Request protocol 请求协议
- %l - Remote logical username from identd (always returns '-') 远端逻辑用户名
- %m - Request method (GET, POST, etc.) 请求类型
- %p - Local port on which this request was received. See also
%{xxx}pbelow. 请求端口 - %q - Query string (prepended with a '?' if it exists) 查询字符串
- %r - First line of the request (method and request URI) 请求字符串(方法 & 请求URL)
- %s - HTTP status code of the response 返回码
- %S - User session ID
- %t - Date and time, in Common Log Format 日期
- %u - Remote user that was authenticated (if any), else '-'
- %U - Requested URL path
- %v - Local server name
- %D - Time taken to process the request, in millis
- %T - Time taken to process the request, in seconds
- %F - Time taken to commit the response, in millis
- %I - Current request thread name (can compare later with stacktraces)
根据日志格式,统计请求 返回码(200, 500,404 等)
提取返回码命令 :
grep ${TODAY} ${LogAccess} | grep -v "GET / HTTP/1.1" | awk '{print $11}' | wc -l
192.145.17.126 10.177.68.157 10.177.68.157 - - [24/Aug/2018:16:48:17 +0800] "GET /CloudNetMonitor/src/app/business/netMonitor/theme/custom/img/mask-loading.gif HTTP/1.1" 200 5093 6
192.145.17.126 10.177.68.157 10.177.68.157 - - [24/Aug/2018:16:48:17 +0800] "POST /CloudNetMonitor/rest/v1/netmonitor/web/smallFlow HTTP/1.1" 200 403 42
192.145.17.126 10.177.68.157 10.177.68.157 - - [24/Aug/2018:16:48:17 +0800] "POST /CloudNetMonitor/rest/v1/netmonitor/web/probe/heartBeat/query HTTP/1.1" 200 2055 59
192.145.17.126 10.177.68.157 10.177.68.157 - - [24/Aug/2018:16:48:18 +0800] "GET /CloudNetMonitor/src/app/business/netMonitor/src/overview/views/currentAlarm.html HTTP/1.1" 200 14350 5
192.145.17.126 10.177.68.157 10.177.68.157 - - [24/Aug/2018:16:48:18 +0800] "GET /CloudNetMonitor/src/app/business/netMonitor/src/overview/controllers/currentAlarmCtrl.js HTTP/1.1" 200 12739 7
192.145.17.126 10.177.68.157 10.177.68.157 - - [24/Aug/2018:16:48:18 +0800] "GET /CloudNetMonitor/src/app/business/netMonitor/src/overview/services/alarmService.js HTTP/1.1" 200 5005 4
192.145.17.126 10.177.68.157 10.177.68.157 - - [24/Aug/2018:16:48:18 +0800] "GET /CloudNetMonitor/src/app/business/netMonitor/src/overview/controllers/ruleHideCtrl.js HTTP/1.1" 200 2890 4
192.145.17.126 10.177.68.157 10.177.68.157 - - [24/Aug/2018:16:48:18 +0800] "POST /CloudNetMonitor/rest/v1/netmonitor/web/syslogAlarmSend/query/activity HTTP/1.1" 200 3337 46
192.145.17.126 10.177.68.157 10.177.68.157 - - [24/Aug/2018:16:48:18 +0800] "GET /CloudNetMonitor/src/app/business/netMonitor/theme/image/major.png HTTP/1.1" 200 1325 4
用定时脚本 每天23:59分 即可统计请求数量
统计web 访问日志的请求数据的更多相关文章
- 机器数据的价值 - Web 访问日志和数据库审计日志
计算机数据 大量的数据流,不断增长的来源,蕴含着巨大的价值 在 Splunk,我们大量谈及计算机数据.这些数据是指在数据中心.“物联网”和互联设备世界中运行的所有系统产生的数据.其中包括支撑组织的应用 ...
- 可视化分析 web 访问日志
内容目录 Python 基础 使用模块介绍 可视化组件 echarts 介绍 Web 访问日志 代码解读 讲师:KK 多语言混搭开发工程师,多年 PHP.Python 项目开发经验,曾就职 360.绿 ...
- Python开发程序:生产环境下实时统计网站访问日志信息
日志实时分析系统 生产环境下有需求:要每搁五分钟统计下这段时间内的网站访问量.UV.独立IP等信息,用直观的数据表格表现出来 环境描述: 网站为Nginx服务,系统每日凌晨会对日志进行分割,拷贝到其他 ...
- Python开发【项目】:生产环境下实时统计网站访问日志信息
日志实时分析系统 生产环境下有需求:要每搁五分钟统计下这段时间内的网站访问量.UV.独立IP等信息,用直观的数据表格表现出来 环境描述: 网站为Nginx服务,系统每日凌晨会对日志进行分割,拷贝到其他 ...
- Centos下Nginx配置WEB访问日志并结合shell脚本定时切割
在一个成熟的WEB系统里,没有日志管理是不可以的,有了日志,可以帮助你得到用户地域来源.跳转来源.使用终端.某个URL访问量等相关信息:通过错误日志,你可以得到系统某个服务或server的性能瓶颈等. ...
- Tomcat配置自定义访问日志 --- 获取请求头部信息
使用tomcat,搭建完个人网站后,默认记录来访游客的信息是十分有限的,主要有ip和路径以及方法等. 有时候为了获取更多来访信息,比如请求的头部信息,这个时候就需要我们手动配置log了. 开始 进入T ...
- 通过Nginx,Tomcat访问日志(access log)记录请求耗时
一.Nginx通过$upstream_response_time $request_time统计请求和后台服务响应时间 nginx.conf使用配置方式: log_format main '$remo ...
- 使用 awstats 分析 Nginx 的访问日志(IBM)
前言 在我的上一篇文章<使用 Nginx 提升网站访问速度>中介绍了 Nginx 这个 HTTP 服务器以及如何通过它来加速网站的访问速度.在实际的网站运营中,我们经常需要了解到网站的访问 ...
- 配置nginx,Tomcat日志记录请求耗时
由于公司的业务比较特殊,对速度比较在意,客户最近反应我们的平台时间比较久,处理一个请求十秒左右才返回,领导要求找出原因,我想让nginx日志记录请求处理用了多长时间,后端处理用了多长时间,总共用了多长 ...
随机推荐
- UVA - 10817 Headmaster's Headache (状压dp+记忆化搜索)
题意:有M个已聘教师,N个候选老师,S个科目,已知每个老师的雇佣费和可教科目,已聘老师必须雇佣,要求每个科目至少两个老师教的情况下,最少的雇佣费用. 分析: 1.为让雇佣费尽可能少,雇佣的老师应教他所 ...
- POJ 2309:BST lowbit
BST Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9140 Accepted: 5580 Description C ...
- CSS屏幕适配尺寸样式
/* 大屏幕 :大于等于1200px*/@media (min-width: 1200px) { ... } /*默认*/@media (min-width: 980px){...} /* 平板电脑和 ...
- 【LeetCode】重新安排行程
[问题]给定一个机票的字符串二维数组 [from, to],子数组中的两个成员分别表示飞机出发和降落的机场地点,对该行程进行重新规划排序.所有这些机票都属于一个从JFK(肯尼迪国际机场)出发的先生,所 ...
- 2.13 ViewModel 使数据即使在后台被杀死数据也能存活
操作程序如下: 主要是创建一个 SavedStateHandle 来缓存上一次的数据,并通过重新读取上一次存储的数据来实现数据的存活 MyVIewModel: package com.example. ...
- 十一、SAP文本变量,并设置长度
一.在SAP中,一个中文占用2个文本长度,详见代码: 二.效果如下
- 134-PHP子类重写父类方法,并调用父类方法
<?php class father{ //定义father类 public function method(){ //定义方法 echo '<br />father method' ...
- Java singleton 单例
饿汉式,instance在类加载化时完成初始化,线程安全 package cookie; public class SingletonAtOnce { private SingletonAtOnce( ...
- 干货分享:常见的留学生Essay写作逻辑结构
任何一种类型的Essay写作都应遵循一种逻辑结构,Long Essay可能在不同部分依据情况使用不同的逻辑结构.本文将为大家分享六种常见留学生Essay写作逻辑结构,为方便阅读本文采用中英文对照方式. ...
- 二、【未来】React环境安装:npx
搭建React的开发环境的第二种方法(新-未来推荐): https://reactjs.org/docs/create-a-new-react-app.html 一. npx简介: 1. npm v5 ...