统计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
enableLookups
for 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}p
below. 请求端口 - %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日志记录请求处理用了多长时间,后端处理用了多长时间,总共用了多长 ...
随机推荐
- 学习进度05(billbill长评爬取02)
今天下雪了,是个看<白色相簿2>的好日子. 昨天我们获取所有长评url,今天要解析这些url获取更多的信息随便,点开一个,我们需要的数据有标题,时间,内容.点赞数和评论先不弄了. 解析js ...
- POJ - 3468 A Simple Problem with Integers (线段树区间更新---间接修改)
题意:区间add,区间求和. #include<cstdio> #include<cstring> #include<cstdlib> #include<cc ...
- uni-app解决小程序圆角样式不生效
在使用uni-app实现小程序的时候,设置左图的右圆角不生效,样式也都没有问题,在模拟器上也可以正常现实,手机上样式出现差别,现有以下解决方法: 设置整个圆角,然后左边使用margin-left:-3 ...
- html5游戏的横屏问题
html5 API有这个参数 Screen Orientation API 可以看w3c定义的规范 The Screen Orientation API <!-- UC强制竖屏 --> & ...
- node - 路由的使用
一,服务器文件 app.js .( 要使用路由的文件) const express = require('express') const app = express() const swig = ...
- 【转载】Android Gradle Build Error:Some file crunching failed, see logs for details解决办法
Android Gradle Build Error:Some file crunching failed, see logs for details解决办法 转载请标明出处: http://www. ...
- tensorflow学习笔记--dataset使用,创建自己的数据集
数据读入需求 我们在训练模型参数时想要从训练数据集中一次取出一小批数据(比如50条.100条)做梯度下降,不断地分批取出数据直到损失函数基本不再减小并且在训练集上的正确率足够高,取出的n条数据还要是预 ...
- Azure Container Registry-基于开源 Docker Registry 的专用 Docker 注册表服务
本文语雀知识库:https://www.yuque.com/seanyu/azure/acr 概述 Azure 容器注册表(Azrue Container Registry,简称ACR)是 Azure ...
- 《新标准C++程序设计》3.8(C++学习笔记10)
友元 友元分为友元函数和友元类两种. 一.友元函数 在定义一个类的时候,可以把一些函数(包括全局函数和其它类的成员函数)声明为“友元”,这样那些函数就成为该类的友元函数,在友元函数内部就可以访问该类对 ...
- SQL 、LINQ日前比较
using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; ...