baicai

白菜

一个勤奋的代码搬运工!

awk analysis commonly used commands for analyzing nginx running logs

awk Analyzing Common Commands for Nginx Running Logs

  1. Unique IP
awk '{print $1}' access.log | sort -r |uniq -c | wc -l
  1. PV Statistics
awk '{print $6}' access.log | wc -l
  1. Query the Most Frequently Accessed URL
awk '{print $7}' access.log|sort | uniq -c |sort -n -k 1 -r|more
  1. Query the Most Frequently Accessed IP
awk '{print $1}' access.log|sort | uniq -c |sort -n -k 1 -r|more
  1. UV Statistics:
awk '{print $6}' access.log | sort -r |uniq -c |wc -l
  1. Hourly Statistics
cat access.log |awk '{print $4}' | awk -F ':' '{print $1,$2}'|uniq -c | awk '{print $2" "$3" "$1}'
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.