###查询nginx日志的访问IP次数
[root@localhost nginx]# awk '{a[$3]++}END{for (v in a)print v,a[v]}' access.log |grep 192.168.1.33
192.168.1.33 38018
[root@localhost nginx]#
###查询nginx的状态码次数,统计192.168.1.33、192.168.1.10访问日志里面的状态码次数
[root@localhost nginx]# grep 192.168.1.33 access.log |head -20
[root@localhost nginx]# grep 192.168.1.33 access.log |head -20 |awk '{a[$11]++}END{for (v in a)print v,a[v]}'
200 20
[root@localhost nginx]# grep -c 192.168.1.10 .access.log
562
[root@localhost nginx]# grep 192.168.1.10 access.log |awk '{a[$11]++}END{for (v in a)print v,a[v]}'
403 562
###查询nginx日志的访问IP次数
[root@localhost nginx]# awk '{a[$3]++}END{for (v in a)print v,a[v]}' access.log|grep 192.168.1.33
192.168.1.33 38018
[root@localhost nginx]#
###查询nginx的状态码次数,统计192.168.1.33、192.168.1.10访问日志里面的状态码次数
[root@localhost nginx]# grep 192.168.1.33 access.log |head -20
[root@localhost nginx]# grep 192.168.1.33 access.log |head -20 |awk '{a[$11]++}END{for (v in a)print v,a[v]}'
200 20
[root@localhost nginx]# grep -c 192.168.1.10 access.log
562
[root@localhost nginx]# grep 192.168.1.10 access.log |awk '{a[$11]++}END{for (v in a)print v,a[v]}'
403 562