Nginx 日志 IP 统计

Today access.log

     78 47.117.201.194
     78 47.117.201.172
     73 47.117.201.206
     71 47.117.201.221
     70 47.117.201.186
     70 47.117.201.164
     70 47.117.201.157
     68 47.117.201.197
     68 47.117.201.195
     67 47.117.201.204
     66 47.117.201.193
     66 47.117.201.189
     66 47.117.201.173
     66 47.117.201.162
     64 47.117.201.207
     64 47.117.201.181
     64 47.117.201.176
     64 47.117.201.160
     63 47.117.201.201
     61 47.117.201.171

Yesterday access.log.1

    534 47.117.201.225
    531 47.117.201.175
    521 47.117.201.203
    520 47.117.201.214
    518 47.117.201.151
    512 47.117.201.201
    512 47.117.201.174
    511 47.117.201.202
    509 47.117.201.177
    509 47.117.201.169
    505 47.117.201.157
    503 47.117.201.223
    502 47.117.201.167
    501 47.117.201.178
    500 47.117.201.213
    499 47.117.201.162
    494 47.117.201.164
    493 47.117.201.155
    491 47.117.201.197
    490 47.117.201.160

“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

📈 历史统计

累计使用次数:826