自动统计nginx日志

yum install nginx -y  :安装nginx,遇到选项全部自动选yes

vim  /etc/nginx/nginx.conf  :查看nginx的配置文件

nginx默认日志格式

    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
$remote_addr   $1

$time_local   $4
$request       $7
$status        $9
$body_bytes_sent $10

1.统计2017年9月5日PV量

2.统计2017年9月5日 一天内访问量最多的10个IP(top10)

3.统计2017年9月5日 访问大于100次的IP

4.统计2017年9月5日 访问最多的10个页面($request)

5.统计2017年9月5日 每个URL访问内容总大小($body_bytes-sent)

6.统计2017年9月5日 每个IP访问状态码数量($status)

7.统计2017年9月5日 IP访问状态码为404及出现次数($status)

8.统计前一分钟的PV量

9.统计2017年9月5日 8:30~9:00 ,访问状态码是404($status)

9.统计2017年9月5日 8:30~9:00 ,访问状态码是404($status)

 

猜你喜欢

转载自www.cnblogs.com/jingzaixin/p/12585738.html