日志分析
日志分析
# 列出当天访问次数最多的IP命令
$ cut -d- -f 1 log_file|uniq -c | sort -rn | head -20
# 查看当天有多少个IP访问:
$ awk '{print $1}' log_file|sort|uniq|wc -l
# 查看某一个页面被访问的次数:
$ grep "/index.php" log_file | wc -l
# 查看每一个IP访问了多少个页面
$ awk '{++S[$1]} END {for (a in S) print a,S[a]}' log_file
# 将每个IP访问的页面数进行从小到大排序
$ awk '{++S[$1]} END {for (a in S) print S[a],a}' log_file | sort -n
# 查看某一个IP访问了哪些页面
$ grep ^111.111.111.111 log_file| awk '{print $1,$7}'
# 去掉搜索引擎统计当天的页面
$ awk '{print $12,$1}' log_file | grep ^\"Mozilla | awk '{print $2}' |sort | uniq | wc -l
# 查看2018年6月21日14时这一个小时内有多少IP访问
$ awk '{print $4,$1}' log_file | grep 21/Jun/2018:14 | awk '{print $2}'| sort | uniq | wc -l删除一个月前的日志:
$ rm -f /www/logs/access.log.$(date -d '-1 month' +'%Y-%m')*统计爬虫:
统计浏览器:
IP统计:
统计网段:
统计域名:
查看HTTP Status:
URL统计:
文件流量统计:
URL访问量统计:
查出运行速度最慢的脚本:
IP、URL提取:
查询攻击者信息
查看IP地址:
根据后门文件名,匹配Apache访问日志得到攻击者的代理IP和User Agent:
Last updated
Was this helpful?