统计指定某一天的PV数
cat cn_net_javascript.access.log | sed -n '/22\/Jul\/2022/p' | wc -l
根据访问IP统计UV
awk '{print $1}' cn_net_javascript.access.log | sort -n | uniq | wc -l
查看某一时间段的IP访问量(4-6点)
grep "22/Jul/2022:0[4-6]" cn_net_javascript.access.log | awk '{print $1}' | sort | uniq -c| sort -nr | wc -l grep "22/Jul/2022" cn_net_javascript.access.log|awk '{ SUM += $9} END { print SUM }' grep "22/Jul/2022" cn_net_javascript.access.log|awk '{sum+=$10} END {print sum/1024/1024/1024}' grep "22/Jul/2022" cn_net_javascript.access.log|awk '{sum+=$9} END {print sum/1024/1024/1024}' grep "22/Jul/2022" cn_net_javascript.access.log|awk '{sum+=$9} END {print sum}'
两个可以统计流量的 Nginx 插件:
https://github.com/joanpc/nginx_vhost_traffic
https://github.com/zls0424/ngx_req_status
参考:
【awk 统计 nginx 日志】https://www.cnblogs.com/mikeluwen/p/7026012.html
【awk 简介】https://www.runoob.com/linux/linux-comm-awk.html
【awk 如何分析日志】https://blog.csdn.net/weixin_36087172/article/details/98482244
【最全的nginx日志统计分析】https://cloud.tencent.com/developer/article/1648497
修改时间 2022-11-27
声明:本站所有文章和图片,如无特殊说明,均为原创发布。商业转载请联系作者获得授权,非商业转载请注明出处。