Linux 统计接口的访问数 最大时长,最小时长,平均时长
统计接口的访问数 平均时长cat access_log.20161207.txt | awk '{a=split($9, b, '/?/'); api=b[1]; if($6<="[07/Dec/2016:01:30:00"&&$6>="[07/Dec/2016:00:30:00"){r[api]
统计接口的访问数 平均时长
cat access_log.20161207.txt | awk '{a=split($9, b, '/?/'); api=b[1]; if($6<="[07/Dec/2016:01:30:00"&&$6>="[07/Dec/2016:00:30:00"){r[api]+=1;t[api]+=$5;sum+=1}}END{for(i in r){print r[i]" "t[i]/r[i]" "i" "sum}}' | sort -rnk 1 | head -50
8469 0.00783186 /elis_smp_als_app/do/core/activity/getActivityWithButton 362545517 0.00185699 /elis_smp_als_app/do/core/activity/detailSimple 36254
4122 0.0493874 /elis_smp_als_app/do/app/getActivityList 36254
统计接口的访问数 平均时长最大时长,最小时长,平均时长
cat access_log.20161118.txt | awk 'a=split($9,b,'/?/');api=b[1];r[api]+=1;t[api]+=$5;{if(max[api]<$5){max[api]=$5;}if(min[api]==0||$5<min[api]){min[api]=$5;} } END {for(i in r)print t[i]/r[i]" "r[i]" " max[i]" "min[api]" "i;}' |sort -rnk 1 |head -50
统计接口指定时间的访问数 总量
cat access_log.20170117.txt | awk '{api=$0;if($6<="[17/Jan/2017:20:50:30"&&$6>="[17/Jan/2017:20:49:49"){ r[api]=$0;t[api]=$5}}END{for(i in r){print sum" "t[i]" "i" "r[i]}}' | sort -rnk 1 | head -100
更多推荐
所有评论(0)