nginx日志分析

来源:互联网 发布:java web excel预览 编辑:程序博客网 时间:2024/05/21 06:42
#!/bin/sh


if [ $# -eq 0 ];then
        echo "plestse specify logfile!"
        exit
else
        #LOG=$1
        cat $1 | egrep -v "112.123.123.123" > LOG
fi


if [ ! -f $1 ];then
echo "could not find file!"
exit
fi


#################################################
echo "most of the ip"
echo "------------------------------------------"
awk '{print $1}' $LOG | sort |uniq -c | sort -nr | head -10
echo
echo
###############################################


echo "most of the time:"
echo "----------------------------------------"
awk '{print $4}' $LOG | cut -c 14-18 | sort | uniq -c | sort -nr | head -10
echo
echo


#############################################
echo "most of the page:"
echo "--------------------------------------"
awk '{print $11}' $LOG | sed 's/^.*\\(.cn*\\)\"/\\1/g' | sort | uniq -c | sort -rn | head -10
echo

echo


也可以用专业的awstats工具分析

0 0
原创粉丝点击