1.获取nginx 日志访问状态码;
grep -ioE "HTTP\/1\.[1|0]\"[[:blank:]][0-9]{3}" nginx_app.api.zhaoyifen.ssl.log
grep -ioE "HTTP\/1\.[1|0]\"[[:blank:]][0-9]{3}" nginx_app.api.zhaoyifen.ssl.log |awk -F"[ ]+" ‘{if($2>=100&&$2<200){i++} else if($2>=200&&$2<300){j++} else if($2>=300&&$2<400){k++} else if ($2>=400&&$2<500){n++}} else if{$2>=500}{p++}}END{print i?1:0,j?:0,n?n:0,p?p:0,p?p:0,i+j+k+n+p}‘
本文出自 “渲染不变的昨天” 博客,请务必保留此出处http://breaklinux.blog.51cto.com/8193722/1976092
原文地址:http://breaklinux.blog.51cto.com/8193722/1976092