Apache日志分析常用Shell命令
2012-11-12 16:35
183 查看
1、查看apache进程:
psaux | grep httpd | grep -vgrep | wc-l
2、查看80端口的tcp连接:
netstat-tan | grep "ESTABLISHED" | grep":80" | wc-l
3、通过日志查看当天ip连接数,过滤重复:
cataccess_log | grep "20/Oct/2008" | awk'{print $2}' | sort| uniq -c | sort -nr
4、当天ip连接数最高的ip都在干些什么(原来是蜘蛛):
cataccess_log | grep "20/Oct/2008:00" | grep"122.102.7.212" | awk'{print $8}' | sort| uniq -c | sort -nr | head -n 10
5、当天访问页面排前10的url:
cataccess_log | grep "20/Oct/2008:00" | awk'{print $8}' | sort| uniq -c | sort -nr | head -n 10
6、用tcpdump嗅探80端口的访问看看谁最高:
tcpdump -i eth0 -tnn dst port 80 -c 1000 |awk -F"."'{print $1"."$2"."$3"."$4}' | sort | uniq-c | sort -nr
接着从日志里查看该ip在干嘛:
cataccess_log | grep 122.102.7.212| awk '{print $1"\t"$8}'| sort | uniq -c | sort-nr | less
7、查看某一时间段的ip连接数:
grep"2006:0[7-8]" www20060723.log | awk '{print $2}' | sort | uniq-c| sort -nr | wc
相关文章推荐
- 常用Apache日志分析命令大全
- 第20讲 常用命令补讲 shell补讲 linux启动过程分析
- Shell日志分析常用命令和例子
- Shell日志分析常用命令和例子
- 分析Apache日志常用命令
- android 性能分析之常用adb命令adb shell am start -W
- shell常用命令及正则辅助日志分析统计
- shell常用命令实例分析-持续更新中
- Shell日志分析常用命令和例子
- (转载)shell日志分析常用命令
- 常用分析日志shell命令
- shell入门——Shell日志分析常用命令和例子
- apache日志分析常用命令
- Apache日志分析(shell命令)
- shell分析日志常用命令快速入门
- apache日志分析常用命令
- Linux apache日志分析常用命令汇总
- apache日志分析常用命令
- android 常用adb 和 adb shell 命令
- Linux常用命令(第二版) --Shell应用技巧