Last active
March 22, 2018 12:21
-
-
Save joostvanveen/59c73ac47ef97fb8c6cb4bc00aeb1ee7 to your computer and use it in GitHub Desktop.
Display the top X visitors by IP address from a single or all nginx access log files
This file contains hidden or 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
# Display the top 20 visitors by IP address from a single log file | |
awk '{print $2}' /var/log/nginx/access.log | sort | uniq -c | sort -nr | head -20 | |
# Display the top 40 visitors by IP address from all rotated gzipped log files | |
zcat /var/log/nginx/access.log* | awk '{print $2}' | sort | uniq -c | sort -nr | head -40 | |
# Find IP adrdresses for all users that created a custoter account for Magento | |
zcat /var/log/nginx/access.log* | awk -v OFS='\t' '/\/customer\/account\/createpost?/ {print $2, $21}' | sort | uniq -c | sort -nr | head -40 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment