Last active
July 13, 2020 12:11
-
-
Save hopewise/95db9d666c81e676307f86bd296d484a to your computer and use it in GitHub Desktop.
NGINX access.log analysis:
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
For NGINX: | |
Show analysis of access.log file | |
goaccess -f /var/log/nginx/access.log --log-format='%h %^[%d:%t %^] "%r" %s %b"%R" "%u" "%f" "%T" "%T" "%T" ' --date-format=%d/%b/%Y --time-format=%T | |
Show analysis of specific route: | |
tail -25000 /var/log/nginx/access.log.1 | grep /webhooks | goaccess --log-format='%h %^[%d:%t %^] "%r" %s %b"%R" "%u" "%f" "%T" "%T" "%T" ' --date-format=%d/%b/%Y --time-format=%T | |
For specific time: >= 5PM <= 8PM, date 12/Jul/2020 | |
cat /var/log/nginx/access.log.1 | awk -F'[: ]' '$4 ~ /12\/Jul\/2020/ && $5 >= 17 && $5 <= 20 { print }' | goaccess --log-format='%h %^[%d:%t %^] "%r" %s %b"%R" "%u" "%f" "%T" "%T" "%T" ' --date-format=%d/%b/%Y --time-format=%T | |
Show analysis against specific IPs, in csv, column $2, and $1 in access files | |
sudo cat ./access.* | awk -F, 'FNR==NR { lines[$2] ; next ; } $1 in lines { print }' ./specific_ips.csv FS=' ' - | goaccess --log-format='%h %^[%d:%t %^] "%r" %s %b"%R" "%u" "%f" ' --date-format=%d/%b/%Y --time-format=%T -a > ips-access.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment