Nginx 日志 IP 统计

Today access.log

    319 47.117.201.200
    319 47.117.201.177
    314 47.117.201.171
    308 47.117.201.194
    308 47.117.201.163
    307 47.117.201.216
    304 47.117.201.212
    302 47.117.201.203
    301 47.117.201.180
    299 47.117.201.192
    298 47.117.201.169
    296 47.117.201.224
    296 47.117.201.196
    295 47.117.201.165
    294 47.117.201.205
    293 47.117.201.191
    293 47.117.201.161
    290 47.117.201.222
    290 47.117.201.218
    290 47.117.201.213

Yesterday access.log.1

    580 47.117.201.228
    569 47.117.201.196
    568 47.117.201.190
    566 47.117.201.150
    565 47.117.201.186
    563 47.117.201.213
    561 47.117.201.206
    561 47.117.201.184
    560 47.117.201.224
    558 47.117.201.203
    556 47.117.201.204
    554 47.117.201.220
    553 47.117.201.201
    553 47.117.201.188
    552 47.117.201.187
    552 47.117.201.153
    551 47.117.201.151
    550 47.117.201.223
    549 47.117.201.218
    547 47.117.201.164

“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

📈 历史统计

累计使用次数:593