Skip to content

Instantly share code, notes, and snippets.

@DominicWatts
Last active June 29, 2022 11:12
Show Gist options
  • Save DominicWatts/45ea7e864766038ef1d43aee84e36886 to your computer and use it in GitHub Desktop.
Save DominicWatts/45ea7e864766038ef1d43aee84e36886 to your computer and use it in GitHub Desktop.
Most visited IPs Access log nginx
## cat
# various
cat access.log | awk '{print $1}' | sort | uniq -c | sort -g | tail -n 20
cat access.log | grep 'wp-admin.php' | awk '{print $1}' | sort | uniq -c | sort -g | tail -n 20
cat access.log | grep "85.93.20.26"
## tail
# user agent
tail access.log -n 10000 | awk '{print $12 $13 $14}' | sort | uniq -c | sort -g | tail -n 20
# ip agent
tail domain-access.log -n 10000 | awk '{print $1 $12}' | sort | uniq -c | sort -g | tail -n 20
# ip
tail access.log -n 10000 | awk '{print $1}' | sort | uniq -c | sort -g | tail -n 20
# search for ip
tail access.log -n 10000 | grep "85.93.20.26"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment