Skip to content

Instantly share code, notes, and snippets.

@trolologuy
Created January 27, 2021 13:50
Show Gist options
  • Save trolologuy/580912a437a0684a84ec44c232e5c12f to your computer and use it in GitHub Desktop.
Save trolologuy/580912a437a0684a84ec44c232e5c12f to your computer and use it in GitHub Desktop.
A simple bash oneliner to parse the server's access.log file to split by http error codes and count them individually.
tail -n 5000 /var/log/access.log | awk '{print $9}' | sort | uniq -c | sort -nr | head -n15
# Example of output:
# 2625 499
# 1433 500
# 569 200
# 243 401
# 108 404
# 16 301
# 6 302
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment