网站日志分析

网站日志如下:

xxxxxx

。。。。

UpopWeb.log.201209040103: === OrderInfo Start ===
UpopWeb.log.201209040103- MerId: 104330148160001
UpopWeb.log.201209040103- AcqCode: null
UpopWeb.log.201209040103- OrderNumber: 20120804154855642
UpopWeb.log.201209040103- TransTime: 20120804154855
UpopWeb.log.201209040103- OrderAmount: null
UpopWeb.log.201209040103- TransType:
UpopWeb.log.201209040103- Cause: Invalid transType :
UpopWeb.log.201209040103- === OrderInfo End ===
UpopWeb.log.201209040103-com.unionpay.upop.web.exceptions.ValidationException: transType无效
UpopWeb.log.201209040103- at com.unionpay.upop.web.api.validator.TransTypeValidator.parse(TransTypeValidator.java:46)

。。。。

1、统计错误总数

grep "=== OrderInfo Start ===" -A9 UpopWeb.log.20120904* |grep "com.unionpay.upop.web.exceptions.ValidationException"|wc -l;

2、查询所有错误类型

grep "=== OrderInfo Start ===" -A9 UpopWeb.log.20120628* |grep "com.unionpay.upop.web.exceptions.ValidationException"|awk -F ":" '{gsub(/ /,"")}{print $2}'| sort | uniq;

3、统计某个错误的总数

grep "=== OrderInfo Start ===" -A9 UpopWeb.log.20120627* |grep "backEndUrl必填"|wc -l;

4、查询出某个错误的详细信息

grep "=== OrderInfo Start ===" -A9 UpopWeb.log.20120628* |grep "backEndUrl必填" -B8|awk 'BEGIN{FS="\n";RS="--\n"}{print $1,":" ,$2}'|awk -F ':' '{print $2,"|",$4}'| awk '{gsub(/[ \t]/,"")}{print $1,$2}'|sort 
 

查询结果(MerId|AcqCode):

305440397060012|
802290063000083|88020000
812010003651296|null
812010020009094|null
812010020009094|null
812010020009094|null
812010020009094|null
812010020009094|null
812010020009094|null
812010020009094|null
812010020009094|null
812010020009094|null
812010020378409|null
812010020983409|48120000
812010021314229|null
null|48120000
 

猜你喜欢

转载自john-cn.iteye.com/blog/1673527