nginx-pv统计

cd /var/log/nginx
scp 10.173.12.18:/var/log/nginx/ld.log-20150407.gz /tmp

gunzip ld.log-20150407.gz

截取POST字段统计全部pv:grep “POST” ld.log-20150407 -c
截取rtbs字段统计rtb-pv:grep “/rtbs” ld.log-20150406 -c
截取rtbamax字段统计rtbamax-pv:grep “/rtbamax” ld.log-20150406 -c

统计峰值pv:grep “/2015:03:28:06″ ld.log-20150406 -c

awk ‘{print $4}’ ld.log-20150403 |sort|uniq -c |sort -r |head -n 10
17280
方法一 基于 questions 计算qps,基于 com_commit com_rollback 计算tps
questions = show global status like ‘questions’;
uptime = show global status like ‘uptime’;
qps=questions/uptime

com_commit = show global status like ‘com_commit’;
com_rollback = show global status like ‘com_rollback’;
uptime = show global status like ‘uptime’;
tps=(com_commit + com_rollback)/uptime

超时统计:netstat -n | awk ‘/^tcp/ {++state[$NF]} END {for(key in state) print key,”\t”,state[key]}’

tail -f ld.log|grep “200”
tail -f ld.log|grep “videoproxy.tanx.com”
awk ‘/www.yyfensi.com/{print $9}’ a.txt
sed -n ‘/14\/Jul\/2015:02/,/14\/Jul\/2015:03/p’ logfile
awk ‘{A[$NF]=A[$NF]+$1}END{for(i in A) print i,A[i]}’

发表评论

邮箱地址不会被公开。