ApacheのアクセスログからIPアドレス部分のみを抜き出し、
重複したIPアドレスが何件あるのか、表示してくれるコマンド。
【コマンド】
cat /var/log/httpd/access_log | cut -d " " -f 1 | sort | uniq -c
【実行結果】
3 1.72.10.73
412 101.143.234.247
2 103.246.38.196
4 107.20.202.46
4 113.32.251.146
重複件数が少ない順に出力させたい場合
【コマンド】
cat /var/log/httpd/access_log | cut -d " " -f 1 | sort | uniq -c |sort
【実行結果】
1 119.235.237.12
1 119.235.237.75
1 119.63.196.10
1 119.63.196.29
重複件数が多い順にしたい場合
【コマンド】
cat /var/log/httpd/access_log | cut -d " " -f 1 | sort | uniq -c |sort -r
【実行結果】
646 124.35.143.180
505 66.249.69.206
408 101.143.234.247