Nginx 日志分析
1.根据访问IP统计UV
awk ‘{print $1}‘ access.log|sort | uniq -c |wc -l
2.统计访问URL统计PV
awk ‘{print $7}‘ access.log|wc -l
3.查询访问最频繁的URL
awk ‘{print $7}‘ access.log|sort | uniq -c |sort -n -k 1 -r|more
4.查询访问最频繁的IP
awk ‘{print $1}‘ access.log|sort | uniq -c |sort -n -k 1 -r|more
5.根据时间段统计查看日志
cat access.log| sed -n ‘/14/Mar/2015:21/,/14/Mar/2015:22/p‘|more
6.访问最多的100个ip及访问次数
awk ‘{print $1}‘ 日志地址 | sort | uniq -c | sort -n -k 1 -r | head -n 100
7.统计来自blog.rekfan.com 包含 ________wd=***********&_____ 并将***********提取出来
awk ‘{print $11}‘ nginx.log|head -n 50|grep "blog.rekfan.com"|sed ‘s/^.*wd=//g‘| sed ‘s/&.*$//g‘
时间: 2024-10-08 05:45:02