r/ScriptSwap • • Dec 17 '17

[help] simple shell script

Hi everyone,

I need help with a simple shell script that can count the number of http 4xx responses per unique ip address in the server access logs at /var/logs/httpd/access_logs

I found this online but doesn’t help much since it tell me the count for all response codes without IP

cat access_log | cut -d ‘“‘ -f3 | cut -d ‘ ‘ -f2 | sort |uniq -c | sort -rn

Please can someone help me? Thank you!

2 Upvotes

5 comments sorted by