Nginx 日志 IP 统计

Today access.log

    394 47.117.201.155
    382 47.117.201.180
    376 47.117.201.178
    374 47.117.201.200
    373 47.117.201.219
    372 47.117.201.199
    372 47.117.201.154
    369 47.117.201.210
    368 47.117.201.175
    367 47.117.201.211
    365 47.117.201.213
    364 47.117.201.183
    359 47.117.201.174
    358 47.117.201.226
    358 47.117.201.203
    358 47.117.201.149
    357 47.117.201.215
    357 47.117.201.207
    357 47.117.201.206
    356 47.117.201.168

Yesterday access.log.1

    524 47.117.201.155
    508 47.117.201.175
    507 47.117.201.185
    500 47.117.201.186
    497 47.117.201.187
    497 47.117.201.167
    490 47.117.201.197
    490 47.117.201.195
    490 47.117.201.193
    489 47.117.201.150
    488 47.117.201.224
    485 47.117.201.168
    483 47.117.201.212
    481 47.117.201.191
    479 47.117.201.177
    478 47.117.201.171
    478 47.117.201.163
    477 47.117.201.218
    477 47.117.201.176
    476 47.117.201.226

“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

📈 历史统计

累计使用次数:478