标签:失败 gre uniq 并发 awk sort echo log fail
##日交易笔数
DAILYTRANNUM=`zcat $LOGPATH|wc -l|tail -n1|awk ‘{print $1}‘`
echo "日交易笔数:$DAILYTRANNUM"
##日成功交易笔数
DAILYSUCTRANNUM=`zcat $LOGPATH|awk -F‘,‘ ‘{if($2=="0000"){print "SUC"}}‘|wc -l|awk ‘{print $1}‘`
echo "日成功交易笔数:$DAILYSUCTRANNUM"
##日失败交易笔数
DAILYFAILTRANNUM=`expr $DAILYTRANNUM - $DAILYSUCTRANNUM`
echo "日失败交易笔数:$DAILYFAILTRANNUM"
##每秒并发峰值
SPEAKTMP=`zcat $LOGPATH|awk -F‘.‘ ‘{print $1}‘|cut -c 9-14|sort|uniq -c|sort -nr|head -n1|awk ‘{print $1" ‘$TRANDATE‘"$2}‘`
echo "每秒并发峰值:$SPEAKTMP"
##每分钟并发峰值
MPEAKTMP=`zcat $LOGPATH|awk -F‘.‘ ‘{print $1}‘|cut -c 9-12|sort|uniq -c|sort -nr|head -n1|awk ‘{print $1" ‘$TRANDATE‘"$2}‘`
echo "每分钟并发峰值:$MPEAKTMP"
##每小时并发峰值
HPEAKTMP=`zcat $LOGPATH|wc -l|grep -v "total"|sort -nr|head -n1|awk ‘{print $1,$2}‘|awk -F‘[ .]‘ ‘{print $1" "$4}‘`
echo "每小时并发峰值:$HPEAKTMP"
##日成功交易分类统计
echo "日成功交易分类统计:"
zcat $LOGPATH|awk -F‘,‘ ‘{if($2=="0000") {print $4}}‘|sort|uniq -c|sort -nr
##失败交易TOP10
echo "失败交易TOP10:"
zcat $LOGPATH|awk -F‘,‘ ‘{if($2!="0000") {print $2}}‘|sort|uniq -c|sort -nr|head -n10
标签:失败 gre uniq 并发 awk sort echo log fail
原文地址:http://www.cnblogs.com/Yloon/p/6003294.html