Nginx 日志 IP 统计

Today access.log

    455 47.117.201.198
    455 47.117.201.157
    453 47.117.201.216
    453 47.117.201.172
    444 47.117.201.183
    443 47.117.201.219
    443 47.117.201.170
    443 47.117.201.150
    442 47.117.201.214
    441 47.117.201.174
    438 47.117.201.207
    438 47.117.201.206
    438 47.117.201.158
    437 47.117.201.227
    437 47.117.201.167
    435 47.117.201.211
    435 47.117.201.186
    435 47.117.201.179
    434 47.117.201.197
    434 47.117.201.190

Yesterday access.log.1

    599 47.117.201.159
    594 47.117.201.220
    589 47.117.201.182
    584 47.117.201.203
    565 47.117.201.213
    565 47.117.201.157
    562 47.117.201.202
    562 47.117.201.152
    557 47.117.201.168
    556 47.117.201.224
    554 47.117.201.200
    553 47.117.201.211
    553 47.117.201.206
    553 47.117.201.187
    553 47.117.201.174
    552 47.117.201.154
    549 47.117.201.210
    548 47.117.201.219
    545 47.117.201.204
    541 47.117.201.149

“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

📈 历史统计

累计使用次数:918