apache日志分析
2015-09-22 15:58
621 查看
列出当天访问次数最多的IP
cut -d- -f 1 /usr/local/apache2/logs/access_log |uniq -c |sort -rn | head -20 cut
-d, --delimiter=DELIM
use DELIM instead of TAB for field delimiter
表示用-分割,然后-f 1
-f, --fields=LIST
selectonly these fields; also print any line that contains no
delimiter character, unless the -s option is specified
表示打印第一部分,就是ip
uniq 是将重复行去掉, -c表示前面加上数目,
sort -rn 就是按照数字从大到小排序,
head -20取前面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}' 查看2009年6月21日14时这一个小时内有多少IP访问:
awk '{print $4,$1}' log_file | grep 21/Jun/2009:14 | awk'{print $2}'| sort | uniq | wc -l
cut -d- -f 1 /usr/local/apache2/logs/access_log |uniq -c |sort -rn | head -20 cut
-d, --delimiter=DELIM
use DELIM instead of TAB for field delimiter
表示用-分割,然后-f 1
-f, --fields=LIST
selectonly these fields; also print any line that contains no
delimiter character, unless the -s option is specified
表示打印第一部分,就是ip
uniq 是将重复行去掉, -c表示前面加上数目,
sort -rn 就是按照数字从大到小排序,
head -20取前面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}' 查看2009年6月21日14时这一个小时内有多少IP访问:
awk '{print $4,$1}' log_file | grep 21/Jun/2009:14 | awk'{print $2}'| sort | uniq | wc -l
相关文章推荐
- Apache Isis 1.4.0 发布,领域驱动开发框架
- Linux快速构建apache web服务器
- Awstats处理多apache日志
- 安装perl模块小窍门
- PHP+Apache在Windows 9x下的安装和配置
- Apache服务器配置全攻略
- Apache Web让JSP“动”起来
- Linux Apache+MySQL+PHP
- 建立Apache+PHP+MySQL数据库驱动的动态网站
- apache 环境下 php 的配置注意事项
- 在RedHat下安装apache jserv 1.1.2方法
- windows中PHP5.2.14以及apache2.2.16安装配置方法第1/2页
- 在Windows XP下安装Apache+MySQL+PHP环境
- JS option location 页面跳转实现代码
- IE中鼠标经过option触发mouseout的解决方法
- JavaScript Select和Option列表元素上下左右移动
- 用jQuery解决IE不支持的option disable属性
- 解析阿里云ubuntu12.04环境下配置Apache+PHP+PHPmyadmin+MYsql
- apache rewrite防盗链三例
- Apache 配置详解(最好的APACHE配置教程)