日期:2014-05-16 浏览次数:20740 次
下面是一段log示例,怎么从log中获取响应时间,并且过滤。
2012-01-17 14:04:29,762 [/// - ] INFO? SERVICE-DIGEST - [(76985289-5788-4a77-965e-34c49e77a89c,tradequery,10.14.25.50,TradeModelQueryFacade.findTradeModel,Y,5ms)(2011100912637902,TradeQueryContext[tableSet=[
TRADE_BASE, TRADE_CHARGE, TRADE_EXTENTION, TRADE_FUND_BILL, TRADE_GOODS_INFO, TRADE_LOGISTICS, TRADE_PROCESS, TRADE_REFUND, TRADE_VOUCHER],tradeOrRefundFlag=0,returnStatusList=<null>,isInStatusList=false,isN
eedAllTradeGoodsInfo=false,environment=<null>])(Result:NOT NULL)]
2012-01-17 14:04:29,778 [/// - ] INFO? SERVICE-DIGEST - [(76985289-5788-4a77-965e-34c49e77a89c,tradequery,10.14.25.50,TradeModelQueryFacade.findTradeModel,Y,5ms)(2011100935672670,TradeQueryContext[tableSet=[
TRADE_BASE, TRADE_CHARGE, TRADE_EXTENTION, TRADE_FUND_BILL, TRADE_GOODS_INFO, TRADE_LOGISTICS, TRADE_PROCESS, TRADE_REFUND, TRADE_VOUCHER],tradeOrRefundFlag=0,returnStatusList=<null>,isInStatusList=false,isN
eedAllTradeGoodsInfo=false,environment=<null>])(Result:NOT NULL)]
这是获取上面log ms时间的大于10s的 shell例子
awk -F"," '{if(int(substr($7,0,index($7,"ms")-1))>10) print substr($7,0,index($7,"ms")-1)}' tradequery-service-digest.log >res_time.csv
下面详细介绍一下awk一些函数,下面是百度文库的参考资料
http://wenku.baidu.com/view/ebac4fc658f5f61fb736664d.html
?