awk Analyzing Common Commands for Nginx Running Logs
- Unique IP
awk '{print $1}' access.log | sort -r |uniq -c | wc -l
- PV Statistics
awk '{print $6}' access.log | wc -l
- Query the Most Frequently Accessed URL
awk '{print $7}' access.log|sort | uniq -c |sort -n -k 1 -r|more
- Query the Most Frequently Accessed IP
awk '{print $1}' access.log|sort | uniq -c |sort -n -k 1 -r|more
- UV Statistics:
awk '{print $6}' access.log | sort -r |uniq -c |wc -l
- Hourly Statistics
cat access.log |awk '{print $4}' | awk -F ':' '{print $1,$2}'|uniq -c | awk '{print $2" "$3" "$1}'