#!/bin/bash
LOG_DIR=/var/log/nginx
PID_DIR=/var/run/nginx.pid
echo -e "/033[36m/033[1m"
cat << EOF
-----------------
+++++++++++++++++
-----------------
EOF
mv "$LOG_DIR"/access.log "$LOG_DIR"/`date +%Y-%m-%d`.log
kill -USR1 `cat $PID_DIR`
echo ok
tail -n 10 /var/log/nginx/access.log |awk '{print $1,$4}' |sed -n '/2016:*:*:*/p' 显示指定时间的 IP
awk '{print $1}' /var/log/nginx/access.log |sort |uniq -c |sort -nr |awk '{if ($1>100) print $0}' 显示访问大于100的IP