`

GoAccess 日志分析 Linux 常用分析日志命令

 
阅读更多
GoAccess命令

#下载GoAccess安装包
wget http://sourceforge.net/projects/goaccess/files/0.4.2/goaccess-0.4.2.tar.gz/download

tar zxvf goaccess-0.4.2.tar.gz
cd goaccess-0.4.2 

./configure –enalbe-geoip –enable-utf8 
make
make install

#goaccess -f /usr/local/nginx/logs/a.log -s -a -b

 

 

Linux 常用分析日志命令

列出当天访问次数最多的IP -20 相当于limit 20
cut -d- -f 1 access.log |uniq -c | sort -rn | head -20

查看当天有多少个IP访问
awk '{print $1}' access.log|sort|uniq|wc -l

查看某一个页面被访问的次数
grep "/index.php" log_file | wc -l

将每个IP访问的页面数进行从小到大排序
awk '{++S[$1]} END {for (a in S) print S[a],a}' access.log | sort -n

查看某一个IP访问了哪些页面
grep ^211.137.153.125 access.log| awk '{print $1,$7}'

去掉搜索引擎统计当天的页面
awk '{print $12,$1}' access.log | grep ^\"Mozilla | awk '{print $2}' |sort | uniq | wc -l

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics