#!/bin/bash
fd=/tmp/log
# pv 点击量
echo "###################点击量 --$pv-- #########################" >> ${fd}tongji.txt
pv=`cat ${fd}a.log | wc -l`
echo "*************************************************************************************" >> ${fd}tongji.txt
#ip
echo "###################IP访问量 --$pv-- #########################" >> ${fd}tongji.txt
ip=`cat a.log |awk ‘{print $1}‘|sort -k1 -r |uniq -c |sort -n -k1 -r|head -10`
echo $ip >> ${fd}tongji.txt
echo "*************************************************************************************" >> ${fd}tongji.txt
# 请求时间、url、耗时,前10名
echo "###################请求时间、url、耗时,前10名 #########################" >> ${fd}tongji.txt
#`cat ${fd}a.log | awk ‘{print $4,$7,$NF}‘ | awk -F ‘"‘ ‘{print $1,$2,$3}‘ | sort -k3 -rn | head -10` >> ${fd}tongji.txt
top=`cat a.log | awk ‘{print $4,$7,$NF}‘| awk -F ‘"‘ ‘{print $1,$2,$3}‘| sort -k3 -rn |grep -vE ‘timed|jpg|png|js|css|html|gif|bmp‘ |head -10`
echo $top >> ${fd}tongji.txt
echo "*************************************************************************************" >> ${fd}tongji.txt
#echo $top10 >> ${fd}tongji.txt