Nginx 日志 IP 统计

Today access.log

    321 121.10.198.7
    285 220.185.158.162
    197 183.207.45.115
    155 117.176.140.134
    145 115.49.123.128
    143 122.191.192.240
    136 125.94.173.236
    130 113.95.134.205
    120 183.7.16.49
    117 31.220.99.243
    117 183.7.19.195
    116 183.10.99.66
    116 183.10.99.26
    115 182.39.151.3
    113 183.7.146.196
    111 183.7.17.148
    110 106.56.105.103
    109 113.95.137.121
    104 183.7.146.3
    103 125.94.173.88

Yesterday access.log.1

    358 182.241.165.141
    352 20.171.207.240
    308 183.7.148.204
    304 66.249.66.76
    297 220.185.158.162
    282 113.95.133.207
    279 113.95.134.205
    278 113.95.137.121
    276 183.7.151.176
    272 183.10.99.66
    272 115.49.123.128
    269 125.94.173.88
    268 48.210.240.47
    268 113.95.135.184
    265 125.94.173.236
    259 183.7.146.196
    250 183.7.16.49
    248 113.95.147.204
    247 66.249.66.77
    237 183.10.99.26

“Knowing is not enough, we must apply. Willing is not enough, we must do.” 🚢

✍ 功能简介

统计 Nginx 日志(access.log)中的请求量排名前 20 的 IP。 方便判断是否有恶意 IP 请求,或者非正规搜索引擎的爬虫 IP。

💻 Nginx 命令

$ awk '{print $1}' access.log | sort | uniq -c | sort -rn | head -n 20

📈 历史统计

累计使用次数:228