jjfjjj 发表于 2018-8-20 10:31:20

每日一shell(七)统计站点的IP和PV

# vim accessnum.sh  #!/bin/bash
  #writen by Gavin Zhao
  #This shell will print how many users access your server by web
  awk '/itks/ {print $1}' /var/log/nginx/access.log | sort -rn | uniq -c | sort -rn | awk '{$2 ~ /10./ && $2!="10.1.46.189" && (tot=to
  t+$0)};END{print NR,tot}'> /root/script/num.txt 2> /dev/null
  ip=`awk '{print $1}' /root/script/num.txt`
  pv=`awk '{print $2}' /root/script/num.txt`
  echo "截止到目前IT知识库的总访问量:$pv"
  echo "截止到目前IT知识库的总访问IP数:$ip"
  echo "排名前10的IP如下:"
  awk '/itks/ {print $1}' /var/log/nginx/access.log | sort -rn | uniq -c | sort -rn | awk ' $2 ~ /10./ && $2 !~ /10.1.46.189|10.1.116.
  4/ && NR
页: [1]
查看完整版本: 每日一shell(七)统计站点的IP和PV