Suche senden
Hochladen
Pptv lb日志实时分析平台
•
Als PPTX, PDF herunterladen
•
8 gefällt mir
•
2,595 views
D
drewz lin
Folgen
Technologie
Kunst & Fotos
Melden
Teilen
Melden
Teilen
1 von 28
Jetzt herunterladen
Empfohlen
D baa s_in_xiaomi
D baa s_in_xiaomi
hdksky
阿里巴巴运维团队的无状态运维思路
阿里巴巴运维团队的无状态运维思路
mysqlops
阿里巴巴运维自动化的探索与规划
阿里巴巴运维自动化的探索与规划
mysqlops
盛大游戏运维体系
盛大游戏运维体系
Ken Liu
浅谈电商网站数据访问层(DAL)与 ORM 之适用性
浅谈电商网站数据访问层(DAL)与 ORM 之适用性
Xuefeng Zhang
MySQL压力测试经验
MySQL压力测试经验
Jinrong Ye
Openstack网络规划
Openstack网络规划
OpenCity Community
Nodejs & NAE
Nodejs & NAE
q3boy
Empfohlen
D baa s_in_xiaomi
D baa s_in_xiaomi
hdksky
阿里巴巴运维团队的无状态运维思路
阿里巴巴运维团队的无状态运维思路
mysqlops
阿里巴巴运维自动化的探索与规划
阿里巴巴运维自动化的探索与规划
mysqlops
盛大游戏运维体系
盛大游戏运维体系
Ken Liu
浅谈电商网站数据访问层(DAL)与 ORM 之适用性
浅谈电商网站数据访问层(DAL)与 ORM 之适用性
Xuefeng Zhang
MySQL压力测试经验
MySQL压力测试经验
Jinrong Ye
Openstack网络规划
Openstack网络规划
OpenCity Community
Nodejs & NAE
Nodejs & NAE
q3boy
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
Scourgen Hong
Cgroup lxc在17173 iaas应用池中应用
Cgroup lxc在17173 iaas应用池中应用
Jinrong Ye
构建基于Lamp的网站架构
构建基于Lamp的网站架构
Cosey Lee
Hacking Nginx at Taobao
Hacking Nginx at Taobao
Joshua Zhu
豆瓣数据架构实践
豆瓣数据架构实践
Xupeng Yun
快速搭建高性能服务端
快速搭建高性能服务端
moonbingbing
美团点评技术沙龙010-点评RDS系统介绍
美团点评技术沙龙010-点评RDS系统介绍
美团点评技术团队
Asp.net core v1.0
Asp.net core v1.0
chang kuo-chao
课题三:Nginx基础知识
课题三:Nginx基础知识
Liu Allen
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--James Liu
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--James Liu
Drupal Taiwan
鹰眼下的淘宝_EagleEye with Taobao
鹰眼下的淘宝_EagleEye with Taobao
terryice
天涯论坛的技术进化史-Qcon2011
天涯论坛的技术进化史-Qcon2011
Yiwei Ma
服务器基准测试-叶金荣@CYOU-20121130
服务器基准测试-叶金荣@CYOU-20121130
Jinrong Ye
02.wls集群
02.wls集群
Meng He
Full stack-development with node js
Full stack-development with node js
Xuefeng Zhang
Zabbix in PPTV
Zabbix in PPTV
ViSenze - Artificial Intelligence for the Visual Web
如何针对业务做DB优化
如何针对业务做DB优化
Jinrong Ye
基于Fuel的超融合一体机
基于Fuel的超融合一体机
EdwardBadBoy
1号店数据库架构
1号店数据库架构
Louis liu
W3CTech美团react专场-Thinking in React
W3CTech美团react专场-Thinking in React
美团点评技术团队
Django敏捷开发 刘天斯
Django敏捷开发 刘天斯
liuts
基于Python构建可扩展的自动化运维平台
基于Python构建可扩展的自动化运维平台
liuts
Weitere ähnliche Inhalte
Was ist angesagt?
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
Scourgen Hong
Cgroup lxc在17173 iaas应用池中应用
Cgroup lxc在17173 iaas应用池中应用
Jinrong Ye
构建基于Lamp的网站架构
构建基于Lamp的网站架构
Cosey Lee
Hacking Nginx at Taobao
Hacking Nginx at Taobao
Joshua Zhu
豆瓣数据架构实践
豆瓣数据架构实践
Xupeng Yun
快速搭建高性能服务端
快速搭建高性能服务端
moonbingbing
美团点评技术沙龙010-点评RDS系统介绍
美团点评技术沙龙010-点评RDS系统介绍
美团点评技术团队
Asp.net core v1.0
Asp.net core v1.0
chang kuo-chao
课题三:Nginx基础知识
课题三:Nginx基础知识
Liu Allen
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--James Liu
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--James Liu
Drupal Taiwan
鹰眼下的淘宝_EagleEye with Taobao
鹰眼下的淘宝_EagleEye with Taobao
terryice
天涯论坛的技术进化史-Qcon2011
天涯论坛的技术进化史-Qcon2011
Yiwei Ma
服务器基准测试-叶金荣@CYOU-20121130
服务器基准测试-叶金荣@CYOU-20121130
Jinrong Ye
02.wls集群
02.wls集群
Meng He
Full stack-development with node js
Full stack-development with node js
Xuefeng Zhang
Zabbix in PPTV
Zabbix in PPTV
ViSenze - Artificial Intelligence for the Visual Web
如何针对业务做DB优化
如何针对业务做DB优化
Jinrong Ye
基于Fuel的超融合一体机
基于Fuel的超融合一体机
EdwardBadBoy
1号店数据库架构
1号店数据库架构
Louis liu
W3CTech美团react专场-Thinking in React
W3CTech美团react专场-Thinking in React
美团点评技术团队
Was ist angesagt?
(20)
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
从林书豪到全明星 - 虎扑网技术架构如何化解流量高峰
Cgroup lxc在17173 iaas应用池中应用
Cgroup lxc在17173 iaas应用池中应用
构建基于Lamp的网站架构
构建基于Lamp的网站架构
Hacking Nginx at Taobao
Hacking Nginx at Taobao
豆瓣数据架构实践
豆瓣数据架构实践
快速搭建高性能服务端
快速搭建高性能服务端
美团点评技术沙龙010-点评RDS系统介绍
美团点评技术沙龙010-点评RDS系统介绍
Asp.net core v1.0
Asp.net core v1.0
课题三:Nginx基础知识
课题三:Nginx基础知识
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--James Liu
[DCTPE2011] 8) 多伺服器/高效能的Drupal 主機解決方案--James Liu
鹰眼下的淘宝_EagleEye with Taobao
鹰眼下的淘宝_EagleEye with Taobao
天涯论坛的技术进化史-Qcon2011
天涯论坛的技术进化史-Qcon2011
服务器基准测试-叶金荣@CYOU-20121130
服务器基准测试-叶金荣@CYOU-20121130
02.wls集群
02.wls集群
Full stack-development with node js
Full stack-development with node js
Zabbix in PPTV
Zabbix in PPTV
如何针对业务做DB优化
如何针对业务做DB优化
基于Fuel的超融合一体机
基于Fuel的超融合一体机
1号店数据库架构
1号店数据库架构
W3CTech美团react专场-Thinking in React
W3CTech美团react专场-Thinking in React
Andere mochten auch
Django敏捷开发 刘天斯
Django敏捷开发 刘天斯
liuts
基于Python构建可扩展的自动化运维平台
基于Python构建可扩展的自动化运维平台
liuts
Wot2015 微博平台护城河-构建高效的防御体系-王关胜
Wot2015 微博平台护城河-构建高效的防御体系-王关胜
Weibo Corporation
美团点评技术沙龙08 - 分布式监控系统实践
美团点评技术沙龙08 - 分布式监控系统实践
美团点评技术团队
搜狐 窦喆 Sohu-sagent
搜狐 窦喆 Sohu-sagent
guiyingshenxia
阿里云 张旭 集群运维管理平台
阿里云 张旭 集群运维管理平台
guiyingshenxia
5.多角度对抗 waf 的思路与实例
5.多角度对抗 waf 的思路与实例
Hsiao Tim
肖康:Storm在实时网络攻击检测和分析的应用与改进
肖康:Storm在实时网络攻击检测和分析的应用与改进
hdhappy001
7.唯品会安全建设与风控杂谈
7.唯品会安全建设与风控杂谈
Hsiao Tim
The Secrets to Get New & Repeat Sales in Furniture and Furnishings Industry
The Secrets to Get New & Repeat Sales in Furniture and Furnishings Industry
Goldsoft
数据分析组14 15
数据分析组14 15
bugu bugu
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Hernan Costante
分布式監控系統的容器化變遷與 CI/CD 實踐
分布式監控系統的容器化變遷與 CI/CD 實踐
Yao-Wei Ou
构建高可用数据库监控系统
构建高可用数据库监控系统
haiyuan ning
The simplethebeautiful
The simplethebeautiful
mysqlops
Performance Testing REST APIs
Performance Testing REST APIs
Jason Weden
WordPress security for everyone
WordPress security for everyone
Vladimír Smitka
API for Beginners
API for Beginners
Gustavo De Vita
大数据场景下应用性能排查的智能根源分析
大数据场景下应用性能排查的智能根源分析
Yuchen Zhao
Splunk資安智慧分析平台
Splunk資安智慧分析平台
Ching-Lin Tao
Andere mochten auch
(20)
Django敏捷开发 刘天斯
Django敏捷开发 刘天斯
基于Python构建可扩展的自动化运维平台
基于Python构建可扩展的自动化运维平台
Wot2015 微博平台护城河-构建高效的防御体系-王关胜
Wot2015 微博平台护城河-构建高效的防御体系-王关胜
美团点评技术沙龙08 - 分布式监控系统实践
美团点评技术沙龙08 - 分布式监控系统实践
搜狐 窦喆 Sohu-sagent
搜狐 窦喆 Sohu-sagent
阿里云 张旭 集群运维管理平台
阿里云 张旭 集群运维管理平台
5.多角度对抗 waf 的思路与实例
5.多角度对抗 waf 的思路与实例
肖康:Storm在实时网络攻击检测和分析的应用与改进
肖康:Storm在实时网络攻击检测和分析的应用与改进
7.唯品会安全建设与风控杂谈
7.唯品会安全建设与风控杂谈
The Secrets to Get New & Repeat Sales in Furniture and Furnishings Industry
The Secrets to Get New & Repeat Sales in Furniture and Furnishings Industry
数据分析组14 15
数据分析组14 15
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...
分布式監控系統的容器化變遷與 CI/CD 實踐
分布式監控系統的容器化變遷與 CI/CD 實踐
构建高可用数据库监控系统
构建高可用数据库监控系统
The simplethebeautiful
The simplethebeautiful
Performance Testing REST APIs
Performance Testing REST APIs
WordPress security for everyone
WordPress security for everyone
API for Beginners
API for Beginners
大数据场景下应用性能排查的智能根源分析
大数据场景下应用性能排查的智能根源分析
Splunk資安智慧分析平台
Splunk資安智慧分析平台
Ähnlich wie Pptv lb日志实时分析平台
Elastic stack day-2
Elastic stack day-2
YI-CHING WU
MySQL自动切换设计与实现
MySQL自动切换设计与实现
orczhou
主库自动切换 V2.0
主库自动切换 V2.0
jinqing zhu
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
YingSiang Geng
Hadoop ecosystem
Hadoop ecosystem
legend900805
MongoDB at Qihoo 360
MongoDB at Qihoo 360
MongoDB
My sql 5.6新特性深入剖析——innodb引擎
My sql 5.6新特性深入剖析——innodb引擎
frogd
Apache trafficserver
Apache trafficserver
Din Dindin
构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接
Renaun Erickson
Glider
Glider
windyrobin
Python 于 webgame 的应用
Python 于 webgame 的应用
勇浩 赖
PHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits Level
Ho Kim
Golang 高性能实战
Golang 高性能实战
rfyiamcool
Osc scott linux下的数据库优化for_postgresql
Osc scott linux下的数据库优化for_postgresql
OpenSourceCamp
線上埋碼資料收集實作
線上埋碼資料收集實作
FEG
Win dbg入门
Win dbg入门
晓锋 陈
Windbg入门
Windbg入门
晓锋 陈
我对后端优化的一点想法
我对后端优化的一点想法
mysqlops
Nosql三步曲
Nosql三步曲
84zhu
Linux binary Exploitation - Basic knowledge
Linux binary Exploitation - Basic knowledge
Angel Boy
Ähnlich wie Pptv lb日志实时分析平台
(20)
Elastic stack day-2
Elastic stack day-2
MySQL自动切换设计与实现
MySQL自动切换设计与实现
主库自动切换 V2.0
主库自动切换 V2.0
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
探索 ISTIO 新型 DATA PLANE 架構 AMBIENT MESH - GOLANG TAIWAN GATHERING #77 X CNTUG
Hadoop ecosystem
Hadoop ecosystem
MongoDB at Qihoo 360
MongoDB at Qihoo 360
My sql 5.6新特性深入剖析——innodb引擎
My sql 5.6新特性深入剖析——innodb引擎
Apache trafficserver
Apache trafficserver
构建ActionScript游戏服务器,支持超过15000并发连接
构建ActionScript游戏服务器,支持超过15000并发连接
Glider
Glider
Python 于 webgame 的应用
Python 于 webgame 的应用
PHP Optimization for Millions Visits Level
PHP Optimization for Millions Visits Level
Golang 高性能实战
Golang 高性能实战
Osc scott linux下的数据库优化for_postgresql
Osc scott linux下的数据库优化for_postgresql
線上埋碼資料收集實作
線上埋碼資料收集實作
Win dbg入门
Win dbg入门
Windbg入门
Windbg入门
我对后端优化的一点想法
我对后端优化的一点想法
Nosql三步曲
Nosql三步曲
Linux binary Exploitation - Basic knowledge
Linux binary Exploitation - Basic knowledge
Mehr von drewz lin
Web security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-keary
drewz lin
Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013
drewz lin
Phu appsec13
Phu appsec13
drewz lin
Owasp2013 johannesullrich
Owasp2013 johannesullrich
drewz lin
Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2
drewz lin
I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2
drewz lin
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
drewz lin
Csrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equal
drewz lin
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
drewz lin
Appsec usa roberthansen
Appsec usa roberthansen
drewz lin
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
drewz lin
Appsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_edits
drewz lin
Appsec2013 presentation
Appsec2013 presentation
drewz lin
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
drewz lin
Appsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martin
drewz lin
Amol scadaowasp
Amol scadaowasp
drewz lin
Agile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usa
drewz lin
Vulnex app secusa2013
Vulnex app secusa2013
drewz lin
基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架
drewz lin
新浪微博稳定性经验谈
新浪微博稳定性经验谈
drewz lin
Mehr von drewz lin
(20)
Web security-–-everything-we-know-is-wrong-eoin-keary
Web security-–-everything-we-know-is-wrong-eoin-keary
Via forensics appsecusa-nov-2013
Via forensics appsecusa-nov-2013
Phu appsec13
Phu appsec13
Owasp2013 johannesullrich
Owasp2013 johannesullrich
Owasp advanced mobile-application-code-review-techniques-v0.2
Owasp advanced mobile-application-code-review-techniques-v0.2
I mas appsecusa-nov13-v2
I mas appsecusa-nov13-v2
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Defeating xss-and-xsrf-with-my faces-frameworks-steve-wolf
Csrf not-all-defenses-are-created-equal
Csrf not-all-defenses-are-created-equal
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Chuck willis-owaspbwa-beyond-1.0-app secusa-2013-11-21
Appsec usa roberthansen
Appsec usa roberthansen
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec usa2013 js_libinsecurity_stefanodipaola
Appsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation-dickson final-with_all_final_edits
Appsec2013 presentation
Appsec2013 presentation
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec 2013-krehel-ondrej-forensic-investigations-of-web-exploitations
Appsec2013 assurance tagging-robert martin
Appsec2013 assurance tagging-robert martin
Amol scadaowasp
Amol scadaowasp
Agile sdlc-v1.1-owasp-app sec-usa
Agile sdlc-v1.1-owasp-app sec-usa
Vulnex app secusa2013
Vulnex app secusa2013
基于虚拟化技术的分布式软件测试框架
基于虚拟化技术的分布式软件测试框架
新浪微博稳定性经验谈
新浪微博稳定性经验谈
Pptv lb日志实时分析平台
1.
PPTV LB日志实时分析平台 XinyiZhou xinyizhou@pptv.com 11/5 2012
2.
Agenda • PPTV LB日志实时分析系统介绍 –
实际面临的问题 – 解决方案 – 系统部署 • 系统实现 – Fluentd(td-agent) – MongoDB – Python Script(PyMongo module) – Zabbix • 应用实例 – Nginx return code 4xx 5xx 监控 – Nginx响应时间监控 – 告警邮件自动分析程序 – LB日志实时分析与自动Release平台的集成
3.
实际面临的问题 • PPTV采用Nginx+Keepalived的方式构建Load Balancer,共有约40台LB server,每台承载10- 50个域名的流量,我们需要精确的把握所有域名的 健康状态(返回码是否正常,4xx/5xx率),及响 应时间变化趋势;能够准实时的发现入侵行为; •
难点: • 日志量大 – 每台LB每天都有几百GB日志(压缩前) • 日志分散不易进行统一分析 • 难以添加有效监控
4.
解决方案(一) • awk+grep+bash+gnuplot • 最方便的一招,比较灵活,计算准确;但实际使用 不方便,看一个域名的日志需要登陆好几台LB •
E.g. 统计非200的top return code • awk '{if ($9 ~ /^[0-9]*$/ && $9 != "200" && $9 !~ /^3/) code[$9]++}END {for ( i in code ) print i " " code[i]}'|sort -k2 –nr • 使用gnuplot对统计结果绘图 • cut –d’’ –f1-4 log.txt | uniq –c | (echo “plot “-” using 2:1 with lines”;cat)|gnuplot
5.
解决方案(二) • Python+zabbix • 每台LB均部署python日志分析脚本,通过 zabbix调度,每隔五分钟对前五分钟生产的 日志文件进行分析,保留分析结果; •
Zabbix负责绘图和告警; • 主要两个缺点: 1)性能瓶颈,日志分析占用大量LB CPU资源 2)不够灵活,日志分析局限于单台LB
6.
解决方案(三) • Fluentd+Mongodb+Python+zabbix • Fluentd实时收集LB日志,JSON化,存入 中央Mongodb •
Python程序查询Mongodb数据进行实时 计算;计算结果存入zabbix;zabbix负责 告警及图形展现 • P.S. That’s what we want!!
7.
Fluentd/Mongodb架构图
8.
Fluentd介绍 • 开源日志收集工具 http://fluentd.org/ •
LOG everything as JSON! • JSON:Schema-free, add/remove field from logs at anytime • 原始日志: “2012-10-01 host1 myapp: message size=1000 user=xyz” • JSON: 2012-10-01 myapp.message { “hostname”: ”host1”, “size”: 1000, “user”: “xyz” }
9.
Fluentd/Mongodb数据流图
10.
Fluentd plugin说明(1) • 在不使用plugin的情况下Fluentd仅仅是将日志输入转化 为JSON格式输出的工具;各类plugin极大拓展了 Fluentd的功能 •
Fluentd plugin有如下三种: • Input plugin 定义日志来源标准化,输入的格式 • Buffer plugin 定义fluentd缓存的配置以实现可靠性 • Output Plugin 定义输出的格式及目的地,可以是文件, 网络,数据库,etc
11.
Fluentd plugin说明(2) • Fluentd
Input Plugin • http – 让fluentd从http client获取数据 • tail – tail是最常用的input plugin; <source> type tail path /var/log/httpd-access.log #tail监听的文件地址 tag apache.access #每个输入需要一个特定标签以区别 format apache|syslog|自定义正则 #format可以灵活自定义 </source> • foward – 将其他fluentd/fluent-cat命令的输出作为该fluentd的输入; • exec – 通过执行外部命令,以命令执行的结果作为fluentd的输入;
12.
Fluentd plugin说明(3) • Fluentd
Output Plugin • Ouput Plugin用于存储Fluentd收集来的数据;目前有很 多开源的plugin,如:fluentd-flume,fluentd- splunk,fluentd-cassandra,fluentd-scribe,fluentd- mongodb • fluent-plugin-mongo 0.6.10 • Output plugin中最完美的当属mongodb plugin,因为 Fluentd/Mongodb都以JSON为基础;mongodb良好的 插入查询性能可以顶住海量日志实时分析的压力; mongodb的capped collection很好的解决了日志定量 轮转的问题
13.
MONGODB部署 • 每个机房部署一台mongodb server,用于 收集该机房全部LB的日志 •
每个mongodb部署多个instance,每个 instance对应一台LB server • 建立多个collection,每个collection保存一 个域名的日志信息 • 一定要使用capped collection!
14.
MONGODB配置 • port =
270XX • dbpath = /home/mongodb/node270xx • logpath = /home/mongodb/node270xx.log • syncdelay = 10 #这个设置10秒左右,将IO压力平 均化,避免sync时影响查询性能 • maxConns = 20000 • oplogSize = 1024 • directoryperdb = on • logappend = on • journal = off • fork = on • nohttpinterface = on
15.
Fluentd部署 • 每台LB上均需安装一个Fluentd agent; 使用TreasureData公司yum源上提供的 td-agent
rpm包安装即可; • 启动方法 /etc/init.d/td-agent start • 关键配置/etc/td-agent/td-agent.conf • 日志文件 /var/log/td-agent/td- agent.log
16.
PPTV Fluentd Input配置 •
<source> • type tail • path /home/logs/nginx/aplus-access.log • pos_file /var/log/td-agent/tmp/aplus.pptv.com.pos • format /^(?<ip>[^ ]*) (?<domain>[^ ]*) - ([^ ]*) ([^ ]*) "(?<url>[^"]*)" (?<code>[^ ]*) (?<bsize>[^ ]*) ("[^"]*") ("[^"]*") ("[^"]*") "(?<restime>[^"]*)" "(?<backend>[^,"]*)[^"]*" "(?<bcode>[^,"]*)[^"]*" "(?<nginxtime>[^"]*)"$/ • tag mongo.aplus.pptv.com.access • </source>
17.
PPTV Fluentd Output配置 •
<match mongo.aplus.pptv.com.access> • type mongo • database LB_hostname • collection aplus.pptv.com.access • host mongodb_host • port mongodb_port • capped • capped_size 180m #确保能够保留最近1小时该域名的日志 • ignore_invalid_record true • buffer_type memory #使用内存作为buffer存储方式 • buffer_chunk_limit 1M • buffer_queue_limit 15 • retry_limit 10 • retry_wait 1s • flush_interval 1s #刷新频率为1s,基本做到实时 • </match>
18.
PPTV日志样例 • 原始日志: 218.26.242.14 999.fb.app.aplus.pptv.com
- [05/Nov/2012:15:42:38 +0800] "GET /recommend_pop/?_=1352101423806 HTTP/1.0" 200 34 "http://v.pptv.com/show/MLibyMJjibbqyJB28.html" "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C)" "60.211.95.201, 127.0.0.1" "0.012" "10.201.10.94:80" "200" "0.012“ MONGODB中的日志: { "_id" : ObjectId("5097755c31d87b09f8046f1f"), "ip" : " 218.26.242.14", "domain" : "999.fb.app.aplus.pptv.com", "url" : " GET /recommend_pop/?_=1352101423806 HTTP/1.0", “code” : “200”, #返回码 "bsize" : “34", #bodysize “restime” : “0.012”, #后端服务响应时间 “backend” : “10.201.10.94:80”, #后端服务地址 “bcode” : “200”, #后端服务返回码 “nginxtime” : “0.012”, #nginx响应时间 "time" : ISODate("2012-11-05T15:42:38Z") }
19.
PPTV LB日志分析逻辑(1) • 为LB日志自动生成fluentd配置文件: •
对某台/log/nginx/*.access.log和 *.error.log: • 根据LB所在机房分配后端mongodb地址/ 端口,根据历史日志大小分配capped collection size,根据LB机器名分配 mongodb database_name,根据域名确 定mongodb collection name.
20.
PPTV LB日志分析逻辑(2) • 保存域名-LB-后端主机的对应关系,并定 期更新(parse
nginx配置文件) • > db.domain_host_info.find({domain:"aplus.pptv.com"}) • { "_id" : ObjectId("5096bc7b19859831d6000002"), "domain" : "aplus.pptv.com", "host" : “lb1", "backend" : “host1" } • { "_id" : ObjectId("5096bc7b19859831d6000003"), "domain" : "aplus.pptv.com", "host" : " lb1", "backend" : “host2" } • { "_id" : ObjectId("5096bc7b19859831d6000004"), "domain" : "aplus.pptv.com", "host" : “lb2", "backend" : “host3" } • { "_id" : ObjectId("5096bc7b19859831d6000005"), "domain" : "aplus.pptv.com", "host" : “lb2", "backend" : “host4" }
21.
PPTV LB日志分析逻辑(3) • 每五分钟对前五分钟mongodb收集到的日志基于域名进行汇 总计算(python/pymongo),得出结果存入mongodb中的 lb_detail表: •
> db.lb_detail.findOne() • { • "_id" : ObjectId("509434522573b0625d000002"), • “domain” : “xxxxx.pptv.com”, #分析的域名 • “ng1_count” : 0, #nginx请求时间超过1秒个数 • “be1_count” : 0, #backend后端响应时间超过1秒个数 • “total_count” : 2703, # 过去5分钟该域名的请求总数 • “backtime_total” : 6.71, # backend后端响应时间总和 • “bodysize_total” : 124100, #bodysize总和 • “xx4_count” : 2, #4xx请求个数 • "time" : ISODate("2012-11-03T05:00:02.634Z"), • “ng3_count” : 0, #nginx请求总时间大于3秒的请求个数 • “c200_count” : 2700, #200请求个数 • “xx5_count” : 1, #5xx请求个数 • “ngxtime_total” : 7.191, #nginx请求总时间 • “be3_count” : 0 #backend响应时间超过3秒的个数 • }
22.
PPTV LB日志分析逻辑(4) • 每五分钟对前五分钟mongodb收集到的日志基于后端机器进行汇总 计算(python/pymongo),得出结果存入mongodb中的 backend_detail表: •
> #某域名xxxx.pptv.com中某后端机器(backend_ip:80)过去5分钟的4xx/5xx/响应时间/超时次数情况 • > db.backend_detail.findOne() • { • "_id" : ObjectId("509677552573b02445000004"), • "bk_xx5_count" : 183, • "bk_be3_count" : 62, • "bk_ng3_count" : 65, • "bk_body_size_total" : 214842812, • "bk_ngx_time_total" : 1443.1720000000564, • "bk_be1_count" : 83, • "domain" : “xxxx.pptv.com", • "bk_total" : 25378, • "server" : “LB_NAME", • "bk_back_time_total" : 1233.362000000008, • "bk_c200_count" : 25140, • "time" : ISODate("2012-11-04T22:10:29.004Z"), • "bk_xx4_count" : 42, • "bk_ng1_count" : 109, • "backend" : “backend_ip:80" • }
23.
PPTV LB日志分析逻辑(5) • 对前面(3),(4)实时分析得出的结果,配置 zabbix监控项进行采集、绘图 •
Zabbix监控脚本使用python/pymongo 查询mongodb中 lb_detail/backend_detail表获取过去5 分钟 某域名的总请求数/2xx率/4xx率 /5xx率/平均响应时间/后端响应超过1秒的 比率等
24.
Zabbix监控(1) • 建立zabbix LB_log_mining监控模板,对每个域名建立总请求数, 4xx/5xx数,后端平均响应时间,nginx响应时间,bodysize平均大小,响 应时间>1秒比例,响应时间>3秒比例
(每五分钟采集一次)
25.
Zabbix监控(2)
26.
Zabbix监控(3) • 如上页所示,某域名的总请求数、4xx、 5xx比率,平均响应时间,均可以在 zabbix中查看变化趋势;针对4xx、5xx率 特别高或者响应时间>3秒的比率特别高的, 可以进行实时告警; • 告警邮件见下图;
27.
Zabbix监控(4) Zabbix告警邮件实例;
28.
The End
Jetzt herunterladen