简简单单 Rails Request log 分析
堵存
2023-12-01
1. 通过 wvanbergen-request-log-analyzer
安装:
gem sources -a http://gems.github.com
sudo gem install wvanbergen-request-log-analyzer
$ request-log-analyzer /var/log/my_app.log
可以分析大多内容,例如:
Top 10 most requested actions
Top 10 actions by time – cumulative
Top 10 actions by time – per request mean
Top 10 worst DB offenders – cumulative time
Top 10 worst DB offenders – mean time
Requests graph – per hour
2, 得到独立IP数量
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq | wc -l
3, 每个IP的访问次数
cat production.log | grep “^Processing” | awk ‘{print $4}’ | uniq -c
4, 得到网站所有访问数量
cat production.log | grep “^Processing” |wc |awk ‘{print $1}’
5, 统计每个页面的各自访问次数
cat production.log |grep “200 OK” | awk ‘{print $17}’ | sort | uniq -c