发表于 2018-8-23 06:25:18

shell 分析 nginx 日志统计

  1.统计ip访问量前10的 ip地址
  cat access.log | awk '{print $1}' | sort | uniq -c | sort -nr | head -n 10
  2.查看当天ip访问量统计
  cat access.log|grep "21/Apr/2016" |awk '{print $1}'|sort|uniq -c|sort -nr
  3.查看访问前10的页面统计
  cat access.log | grep "21/Apr/2016" | awk '{print $7}' | sort | uniq -c | sort -nr |      head -n 10
  4.查看当天访问次数最多的时间段
  tail -n 1000 access.log | awk '{print $4}'|cut -c 14-21 |sort|uniq -c|sort -rn|head -10|more

页: [1]
查看完整版本: shell 分析 nginx 日志统计