参考网址:
[url]http://github.com/wvanbergen/request-log-analyzer[/url]
[url]http://www.letrails.cn/archives/rails-performance-optimization-guide/[/url]
[url]http://wiki.github.com/wvanbergen/request-log-analyzer/basic-usage[/url]
Getting started
Use RubyGems to install request-log-analyzer on your computer:
Now you can run request-log-analyzer to analyze a log file:
Basic usage
If you want to analyze a Rails production log file, use the following syntax:
This will generate a report, similar to our Sample output. If you want analyze multiple files (because of logrotate or multiple mongrel log files), you can provide multiple filenames or use wildcards. The files will be process in the order that they are given on the command line.
Parsing from the standard input
Request-log-analyzer can also parse the standard input by using - or STDIN as filename. This is great in combination with the UNIX tail -f command to parse information live, as it is written to the log file.
Request-log-analyzer will then parse any information that is written to the log file until it is stopped by pressing CTRL+C, after which it will present the performance report for all data that has been collected up to that point.
Examples
[url]http://github.com/wvanbergen/request-log-analyzer[/url]
[url]http://www.letrails.cn/archives/rails-performance-optimization-guide/[/url]
[url]http://wiki.github.com/wvanbergen/request-log-analyzer/basic-usage[/url]
Getting started
Use RubyGems to install request-log-analyzer on your computer:
$ gem install request-log-analyzerNow you can run request-log-analyzer to analyze a log file:
$ request-log-analyzer log/production.logBasic usage
If you want to analyze a Rails production log file, use the following syntax:
$ request-log-analyzer production.logThis will generate a report, similar to our Sample output. If you want analyze multiple files (because of logrotate or multiple mongrel log files), you can provide multiple filenames or use wildcards. The files will be process in the order that they are given on the command line.
$ request-log-analyzer mongrel.2008-11.log mongrel.2008-12.log mongrel.2009-01.log $ request-log-analyzer production.*.logParsing from the standard input
Request-log-analyzer can also parse the standard input by using - or STDIN as filename. This is great in combination with the UNIX tail -f command to parse information live, as it is written to the log file.
$ tail -f production.log | request-log-analyzer -Request-log-analyzer will then parse any information that is written to the log file until it is stopped by pressing CTRL+C, after which it will present the performance report for all data that has been collected up to that point.
Examples
Write an HTML report to report.html:
$ request-log-analyzer log/production.log --file report.html --output HTML
Only use uncolored ASCII characters in the report:
$ request-log-analyzer log/production.log --boring
Create a database named requests.db with all parsed request information
$ request-log-analyzer log/production.log --database requests.db
本文介绍了一款名为request-log-analyzer的日志分析工具,通过Ruby Gems安装后,可以用来分析Rails项目的生产环境日志文件。支持单文件或多文件分析,并能生成HTML报告,还能将分析结果保存到数据库中。
717

被折叠的 条评论
为什么被折叠?



