Nginx 日志 IP 统计

Today access.log

    142 47.123.117.66
    137 47.123.117.33
    131 47.123.117.34
    127 47.123.117.53
    124 47.123.117.41
    123 47.123.117.93
    121 47.123.117.96
    120 47.123.117.58
    120 47.123.117.55
    120 47.123.117.32
    119 47.123.117.56
    119 47.123.117.22
    118 47.123.117.59
    117 47.123.117.95
    116 47.123.117.89
    116 47.123.117.82
    116 47.123.117.39
    115 47.123.117.52
    114 47.123.117.90
    114 47.123.117.80

Yesterday access.log.1

    768 47.123.117.63
    762 47.123.117.21
    747 47.123.117.35
    744 47.123.117.50
    742 47.123.117.68
    742 47.123.117.44
    739 47.123.117.94
    739 47.123.117.93
    732 47.123.117.97
    731 47.123.117.38
    724 47.123.117.89
    721 47.123.117.77
    720 47.123.117.91
    719 47.123.117.55
    718 47.123.117.66
    715 47.123.117.90
    710 47.123.117.60
    708 47.123.117.96
    707 47.123.117.41
    706 47.123.117.48

“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

📈 历史统计

累计使用次数:1586