Nginx 日志 IP 统计

Today access.log

    468 47.117.201.205
    465 47.117.201.186
    459 47.117.201.224
    453 47.117.201.204
    451 47.117.201.216
    449 47.117.201.226
    445 47.117.201.201
    444 47.117.201.174
    444 47.117.201.170
    443 47.117.201.219
    439 47.117.201.214
    438 47.117.201.192
    438 47.117.201.171
    437 47.117.201.164
    436 47.117.201.218
    435 47.117.201.178
    432 47.117.201.169
    432 47.117.201.161
    431 47.117.201.206
    430 47.117.201.220

Yesterday access.log.1

    608 47.117.201.219
    607 47.117.201.225
    605 47.117.201.192
    604 47.117.201.210
    604 47.117.201.154
    598 47.117.201.202
    591 47.117.201.185
    587 47.117.201.160
    584 47.117.201.191
    583 47.117.201.168
    582 47.117.201.157
    576 47.117.201.177
    575 47.117.201.171
    573 47.117.201.209
    573 47.117.201.163
    572 47.117.201.193
    570 47.117.201.212
    570 47.117.201.162
    568 47.117.201.176
    567 47.117.201.165

“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

📈 历史统计

累计使用次数:1013