#!/bin/bashlogHome=/data/server/tomcats/tomcat7_8180_apiService/logsresultLog=/data/shell/result_fetch.outcd $logHomefilelist=`ls $logHome|grep -w FACEBOOK20140723`for file in $filelistdo if test -f $file then echo "$file :" >>$resultLog startTime="00:00:00" endTime="00:10:00" for time in $(seq 1 144) do taskCounter=`grep 'use local address:' $file|awk '{print $2}'|awk -F "," '{if($1>="'$startTime'"&&$1<"'$endTime'") {print $1}}'|wc -l` errorCounter=`grep 'invalid,change token:' $file|awk '{print $2}'|awk -F "," '{if($1>="'$startTime'"&&$1<"'$endTime'") {print $1}}'|wc -l` echo "[$startTime~$endTime]: 抓取总数:$taskCounter 重试总次数:$errorCounter" >> $resultLog startTime=$endTime temp=$(date +%s -d "$startTime") temp=$(($temp+10*60)) endTime=`date +%T -d "1970-01-01 UTC $temp seconds"` done fidone
#!/bin/bashlogHome=/data/server/tomcats/tomcat7_8380_controlService/logsresultLog=/data/shell/result.outcd $logHomefilelist=`ls $logHome|grep FACEBOOK`for file in $filelistdo if test -f $file then echo "$file :" >>$resultLog startTime="00:00:00" endTime="00:10:00" for time in $(seq 1 144) do taskCounter=`grep 'doSearchTask===>task:' $file|awk '{print $2}'|awk -F "," '{if($1>="'$startTime'" && $1<"'$endTime'") {print $1}}'|wc -l` errorCounter=`grep 'OAuthException,code:613' $file|awk '{print $2}'|awk -F "," '{if($1>="'$startTime'" && $1<"'$endTime'") {print $1}}'|wc -l` echo "[$startTime~$endTime]: 任务总数:$taskCounter 异常总数:$errorCounter" >> $resultLog startTime=$endTime temp=$(date +%s -d "$startTime") temp=$(($temp+10*60)) endTime=`date +%T -d "1970-01-01 UTC $temp seconds"` done fidone