关于统计log

写个脚本统计log

 

day=$1;
type=$2;
typefile="/data/wens/sharefile/type";
for type in `cat $typefile`
do
searchKey="type:$type,";
echo "type:$type";
if [ "$type" == "" ]; then
  searchKey="INFO";
fi
catfile="/data/xce/XwServiceUGC/log/share/share-create.log";
if [ "$day" != "" ]; then
 catfile=${catfile}_${day};
fi
num=`ssh [email protected] "cat $catfile | grep $searchKey | wc -l"`

if [ "$day" == "" ];then
 echo "截止 day:`date` - share type:$type - num:$num"
fi

if [ "$day" != "" ];then
 echo "day:$day - share type:$type - num:$num"
fi
done;
num=`ssh [email protected] "cat $catfile | grep INFO | wc -l"`
echo "截止 `date` 今天IM分享总数为 $num ";

你可能感兴趣的:(脚本,ssh)