Nginx 日志 IP 统计

Today access.log

    622 47.117.201.177
    602 47.117.201.214
    581 47.117.201.196
    577 47.117.201.156
    575 47.117.201.203
    572 47.117.201.150
    571 47.117.201.191
    567 47.117.201.225
    567 47.117.201.189
    567 47.117.201.176
    567 47.117.201.161
    559 47.117.201.226
    559 47.117.201.215
    559 47.117.201.167
    553 47.117.201.180
    553 47.117.201.162
    553 47.117.201.154
    551 47.117.201.211
    551 47.117.201.164
    549 47.117.201.187

Yesterday access.log.1

    609 47.117.201.205
    590 47.117.201.222
    589 47.117.201.224
    585 47.117.201.204
    584 47.117.201.226
    583 47.117.201.186
    582 47.117.201.169
    579 47.117.201.201
    575 47.117.201.178
    575 47.117.201.170
    574 47.117.201.216
    574 47.117.201.192
    573 47.117.201.174
    572 47.117.201.164
    569 47.117.201.206
    567 47.117.201.196
    565 47.117.201.219
    565 47.117.201.218
    565 47.117.201.171
    564 47.117.201.207

“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

📈 历史统计

累计使用次数:1018