Created
August 11, 2021 18:22
-
-
Save rojenzaman/2a20c0f870e15a69f004bd8d8fa86341 to your computer and use it in GitHub Desktop.
Count IP address in Nginx access logs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ "$#" -lt 1 ]; then | |
echo "Usage: `basename $0` <access.log>" | |
exit 1 | |
fi | |
awk '{print $1}' "${1}" | sort | uniq -c | sort -nr |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment