Now Hiring: Are you a driven and motivated 1st Line IT Support Engineer?

Blog

NGINX 做CDN的 流量统计分析方案和思路

NGINX 做CDN的 流量统计分析方案和思路

NGINX 做CDN里的流量统计分析 方案

在Nginx配置文件里 增加一个日志格式
记录 Status Code 和Send字节数
200 11111

使用脚本 将日志每3小时定时切割
在使用相关同步工具 将日志文件同步到主控服务器
不同节点命名为 域名_BW_Node1-10_date.log
(这样的好处是便于不同的节点流量负载做统计)

使用AWK 将日志文件的第二列 相加 获得发送的总流量
也可以过滤掉404类状态 仅保留200 301状态的流量

将不同节点同步过来的日志文件
在主控服务器进行相加并且写入数据数据库
如果要RRD tool绘制流量时间段图表
需要每个时间段都要处理一次 比如一小时
做个cronjob任务 自动处理即可

相关:

  • nginx cdn

Leave your thought here

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理

Select the fields to be shown. Others will be hidden. Drag and drop to rearrange the order.
  • Image
  • SKU
  • Rating
  • Price
  • Stock
  • Availability
  • Add to cart
  • Description
  • Content
  • Weight
  • Dimensions
  • Additional information
Click outside to hide the comparison bar
Compare