###查詢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