Skip to content

Instantly share code, notes, and snippets.

@adyavanapalli
Created February 6, 2019 15:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adyavanapalli/ed326b356e35104bbe77fa55cfd0b3be to your computer and use it in GitHub Desktop.
Save adyavanapalli/ed326b356e35104bbe77fa55cfd0b3be to your computer and use it in GitHub Desktop.
Counts and sorts each unique IP address in the NGINX `access.log` file, and pipes the output to `less`.
#!/usr/bin/env bash
# count_nginx_access.sh
sudo sudo awk '{print $1}' access.log | sort | uniq -c | sort -nr | less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment