标签:日志切割
#!/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
本文出自 “秋水无痕” 博客,请务必保留此出处http://7456193.blog.51cto.com/7446193/1788533
标签:日志切割
原文地址:http://7456193.blog.51cto.com/7446193/1788533