Nginx 日志 IP 统计

Today access.log

    154 47.117.201.197
    154 47.117.201.196
    153 47.117.201.221
    153 47.117.201.179
    153 47.117.201.167
    150 47.117.201.171
    148 47.117.201.220
    146 47.117.201.206
    146 47.117.201.178
    145 47.117.201.189
    144 47.117.201.226
    144 47.117.201.185
    143 47.117.201.227
    143 47.117.201.169
    143 47.117.201.153
    142 47.117.201.208
    142 47.117.201.177
    141 47.117.201.149
    140 47.117.201.223
    140 47.117.201.219

Yesterday access.log.1

    661 47.117.201.224
    631 47.117.201.215
    625 47.117.201.204
    622 47.117.201.226
    621 47.117.201.197
    611 47.117.201.200
    611 47.117.201.180
    610 47.117.201.228
    610 47.117.201.219
    601 47.117.201.206
    597 47.117.201.182
    596 47.117.201.209
    595 47.117.201.207
    594 47.117.201.154
    593 47.117.201.203
    592 47.117.201.196
    591 47.117.201.153
    590 47.117.201.212
    590 47.117.201.162
    589 47.117.201.205

“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

📈 历史统计

累计使用次数:601