This is a simple command line tool to analyze request log files in various formats to produce a performance report. Its purpose is to find what actions are best candidates for optimization.
Analyzes log files. Currently supports: Amazon S3, Apache, Delayed::Job, Merb, Mysql, PostgreSQL, Rack, Rails and more.
Combines multiple files and decompresses compressed files, which comes in handy if you are using logrotate.
Uses several metrics, including cumulative request time, mean request time, process blockers, database and rendering time, HTTP methods and statuses, Rails action cache statistics, etc.) (Sample output: github.com/wvanbergen/request-log-analyzer/wiki/sample-output )
Low memory footprint and reasonably fast, so it is safe to run on a production server.
MIT licensed
See the project wiki at github.com/wvanbergen/request-log-analyzer/wiki for documentation and additional information.
Install request-log-analyzer as a Ruby gem (you might need to run this command as root by prepending sudo to it):
$ gem install request-log-analyzer
To analyze a Rails log file and produce a performance report, run request-log-analyzer like this:
因为本地windows本地不能使用gem远程下载
第一步、下载zip文件,复制到redmine安装目录下的vendor\rails\
第二步、允许 ruby redmine安装目录下的vendor\rails\\bin\request-log-analyzer --option redmine安装目录\log\production.log,可以使用--file log-analyzer.txt输出到具体的文件上去
第三步、查看具体的导出文件,分析的结果还是比较清晰的
Request-log-analyzer summary report -------------------------------------------------------------------------------- Version 1.12.1 - written by Willem van Bergen and Bart ten Brinke Website: http://github.com/wvanbergen/request-log-analyzer Request summary -------------------------------------------------------------------------------- Parsed lines: 18747 Skipped lines: 0 Parsed requests: 9374 Skipped requests: 0 First request: 2012-03-05 18:06:06 Last request: 2012-03-06 17:38:05 Total time analyzed: 1 days Request distribution per hour -------------------------------------------------------------------------------- 0:00 | 0 hits/day | 1:00 | 0 hits/day | 2:00 | 0 hits/day | 3:00 | 0 hits/day | 4:00 | 0 hits/day | 5:00 | 0 hits/day | 6:00 | 0 hits/day | 7:00 | 0 hits/day | 8:00 | 102 hits/day | = 9:00 | 1434 hits/day | ======== 10:00 | 202 hits/day | = 11:00 | 158 hits/day | = 12:00 | 2 hits/day | 13:00 | 6012 hits/day | =================================== 14:00 | 342 hits/day | == 15:00 | 137 hits/day | = 16:00 | 173 hits/day | = 17:00 | 731 hits/day | ==== 18:00 | 21 hits/day | 19:00 | 0 hits/day | 20:00 | 21 hits/day | 21:00 | 2 hits/day | 22:00 | 37 hits/day | 23:00 | 0 hits/day | Most requested -------------------------------------------------------------------------------- AccountController#login.html [GET] | 3655 hits | 39.0% | ====== MessagesController#show.html [GET] | 3296 hits | 35.2% | ===== ProjectsController#show.html [GET] | 520 hits | 5.5% | = IssuesController#show.html [GET] | 467 hits | 5.0% | = IssuesController#index.html [GET] | 173 hits | 1.8% | AttachmentsController#show.html [GET] | 169 hits | 1.8% | MyController#page.html [GET] | 162 hits | 1.7% | WelcomeController#index.html [GET] | 126 hits | 1.3% | IssuesController#update.html [PUT] | 118 hits | 1.3% | AccountController#login.html [POST] | 79 hits | 0.8% | IssuesController#new.html [GET] | 71 hits | 0.8% | IssuesController#create.html [POST] | 57 hits | 0.6% | GanttsController#show.html [GET] | 57 hits | 0.6% | IssuesController#new.html [POST] | 49 hits | 0.5% | AutoCompletesController#issues.html [POST] | 48 hits | 0.5% | TimelogController#new.html [GET] | 37 hits | 0.4% | ApplicationController#index.html [GET] | 36 hits | 0.4% | ProjectsController#index.html [GET] | 34 hits | 0.4% | TimelogController#create.html [POST] | 31 hits | 0.3% | IssuesController#index.html [POST] | 25 hits | 0.3% | HTTP methods -------------------------------------------------------------------------------- GET | 8922 hits | 95.2% | ================================================= POST | 309 hits | 3.3% | == PUT | 142 hits | 1.5% | = DELETE | 1 hits | 0.0% | HTTP statuses returned -------------------------------------------------------------------------------- 200 | 5226 hits | 56.0% | ============================== 302 | 4107 hits | 44.0% | ======================== 403 | 2 hits | 0.0% | 406 | 2 hits | 0.0% | Rails action cache hits -------------------------------------------------------------------------------- No hit | 9374 hits | 100.0% | ================================================== -------------------------------------------------------------------------------- Request dura | Hits | Sum | Mean | StdDev | Min | Max | 95 %tile -------------------------------------------------------------------------------- IssuesContro | 467 | 5m10s | 0.66s | 0.60s | 0.00s | 7.45s | 0.22s-2.26s AccountContr | 3655 | 4m55s | 0.08s | 0.13s | 0.02s | 2.12s | 0.03s-0.50s TimesheetCon | 8 | 3m58s | 29.78s | 1m04s | 4.59s | 3m07s | 4.59s-3m10s IssuesContro | 173 | 3m03s | 1.06s | 0.65s | 0.00s | 4.83s | 0.31s-3.17s IssuesContro | 118 | 2m28s | 1.25s | 1.14s | 0.11s | 9.30s | 0.19s-4.10s MessagesCont | 3296 | 1m23s | 0.03s | 0.12s | 0.00s | 4.41s | 0.00s-0.30s GanttsContro | 57 | 1m22s | 1.44s | 1.12s | 0.28s | 5.52s | 0.30s-4.82s MyController | 162 | 1m20s | 0.49s | 0.38s | 0.00s | 1.95s | 0.12s-1.80s IssuesContro | 57 | 1m07s | 1.18s | 1.33s | 0.12s | 9.47s | 0.14s-3.38s ProjectsCont | 520 | 56.26s | 0.11s | 0.25s | 0.00s | 2.34s | 0.00s-0.77s WelcomeContr | 126 | 54.32s | 0.43s | 0.57s | 0.00s | 3.28s | 0.00s-2.49s Knowledgebas | 16 | 43.80s | 2.74s | 1.60s | 0.70s | 5.36s | 0.70s-5.40s TimeEntryRep | 2 | 43.61s | 21.80s | 2.18s | 20.27s | 23.34s | 20.23s-23.39s ProjectsCont | 34 | 38.50s | 1.13s | 0.75s | 0.00s | 3.73s | 0.00s-3.78s TimeEntryRep | 4 | 34.34s | 8.59s | 14.87s | 0.39s | 30.86s | 0.39s-31.26s IssuesContro | 71 | 31.71s | 0.45s | 0.39s | 0.14s | 2.27s | 0.16s-1.69s IssuesContro | 25 | 29.94s | 1.20s | 1.01s | 0.20s | 4.34s | 0.20s-4.38s TimesheetCon | 8 | 24.42s | 3.05s | 1.34s | 1.03s | 4.42s | 1.03s-4.45s TimelogContr | 21 | 18.74s | 0.89s | 0.94s | 0.17s | 3.42s | 0.17s-3.44s IssuesContro | 1 | 15.12s | 15.12s | 0.00s | 15.12s | 15.12s | 14.89s-15.38s -------------------------------------------------------------------------------- Request dura | Hits | Sum | Mean | StdDev | Min | Max | 95 %tile -------------------------------------------------------------------------------- TimesheetCon | 8 | 3m58s | 29.78s | 1m04s | 4.59s | 3m07s | 4.59s-3m10s TimeEntryRep | 2 | 43.61s | 21.80s | 2.18s | 20.27s | 23.34s | 20.23s-23.39s IssuesContro | 1 | 15.12s | 15.12s | 0.00s | 15.12s | 15.12s | 14.89s-15.38s TimeEntryRep | 4 | 34.34s | 8.59s | 14.87s | 0.39s | 30.86s | 0.39s-31.26s TimesheetCon | 8 | 24.42s | 3.05s | 1.34s | 1.03s | 4.42s | 1.03s-4.45s Knowledgebas | 16 | 43.80s | 2.74s | 1.60s | 0.70s | 5.36s | 0.70s-5.40s ActivitiesCo | 1 | 1.95s | 1.95s | 0.00s | 1.95s | 1.95s | 1.92s-1.99s IssuesContro | 1 | 1.89s | 1.89s | 0.00s | 1.89s | 1.89s | 1.86s-1.92s GanttsContro | 57 | 1m22s | 1.44s | 1.12s | 0.28s | 5.52s | 0.30s-4.82s IssuesContro | 118 | 2m28s | 1.25s | 1.14s | 0.11s | 9.30s | 0.19s-4.10s ProjectsCont | 4 | 4.98s | 1.25s | 0.51s | 0.69s | 1.91s | 0.69s-1.92s IssuesContro | 25 | 29.94s | 1.20s | 1.01s | 0.20s | 4.34s | 0.20s-4.38s IssuesContro | 57 | 1m07s | 1.18s | 1.33s | 0.12s | 9.47s | 0.14s-3.38s ProjectsCont | 34 | 38.50s | 1.13s | 0.75s | 0.00s | 3.73s | 0.00s-3.78s IssuesContro | 173 | 3m03s | 1.06s | 0.65s | 0.00s | 4.83s | 0.31s-3.17s DocumentsCon | 1 | 1.05s | 1.05s | 0.00s | 1.05s | 1.05s | 1.04s-1.08s MyController | 1 | 1.03s | 1.03s | 0.00s | 1.03s | 1.03s | 1.03s-1.06s TimelogContr | 21 | 18.74s | 0.89s | 0.94s | 0.17s | 3.42s | 0.17s-3.44s MembersContr | 1 | 0.84s | 0.84s | 0.00s | 0.84s | 0.84s | 0.83s-0.86s ContextMenus | 3 | 2.23s | 0.74s | 0.56s | 0.11s | 1.14s | 0.11s-1.15s -------------------------------------------------------------------------------- View renderin | Hits | Sum | Mean | StdDev | Min | Max | 95 %tile -------------------------------------------------------------------------------- IssuesControl | 463 | 3m59s | 0.52s | 0.55s | 0.14s | 7.38s | 0.17s-1.99s AccountContro | 3655 | 2m42s | 0.04s | 0.10s | 0.00s | 1.81s | 0.00s-0.40s IssuesControl | 171 | 2m21s | 0.82s | 0.51s | 0.17s | 3.69s | 0.22s-2.15s GanttsControl | 57 | 1m16s | 1.33s | 1.12s | 0.20s | 5.28s | 0.23s-4.74s MyController# | 160 | 1m05s | 0.41s | 0.33s | 0.09s | 1.81s | 0.09s-1.49s WelcomeContro | 78 | 37.85s | 0.49s | 0.44s | 0.12s | 2.23s | 0.14s-1.92s Knowledgebase | 16 | 31.55s | 1.97s | 1.39s | 0.52s | 5.28s | 0.51s-5.31s ProjectsContr | 31 | 25.56s | 0.82s | 0.62s | 0.25s | 3.09s | 0.25s-3.12s TimeEntryRepo | 4 | 21.44s | 5.36s | 9.87s | 0.05s | 20.16s | 0.05s-20.23s IssuesControl | 25 | 19.10s | 0.76s | 0.76s | 0.06s | 3.55s | 0.06s-3.55s TimesheetCont | 8 | 18.67s | 2.33s | 0.85s | 1.34s | 4.22s | 1.33s-4.24s ProjectsContr | 77 | 17.27s | 0.22s | 0.24s | 0.05s | 1.53s | 0.06s-0.89s IssuesControl | 71 | 14.73s | 0.21s | 0.18s | 0.06s | 1.03s | 0.08s-0.70s TimelogContro | 21 | 13.69s | 0.65s | 0.77s | 0.11s | 2.83s | 0.11s-2.83s TimesheetCont | 8 | 12.36s | 1.54s | 1.01s | 0.42s | 2.98s | 0.42s-3.02s TimelogContro | 24 | 5.72s | 0.24s | 0.35s | 0.03s | 1.53s | 0.03s-1.53s IssuesControl | 49 | 3.77s | 0.08s | 0.13s | 0.00s | 0.61s | 0.00s-0.61s TimelogContro | 37 | 3.66s | 0.10s | 0.11s | 0.03s | 0.61s | 0.03s-0.61s ProjectsContr | 4 | 2.91s | 0.73s | 0.14s | 0.58s | 0.91s | 0.57s-0.92s SearchControl | 12 | 2.78s | 0.23s | 0.22s | 0.02s | 0.73s | 0.02s-0.74s -------------------------------------------------------------------------------- View renderin | Hits | Sum | Mean | StdDev | Min | Max | 95 %tile -------------------------------------------------------------------------------- TimeEntryRepo | 4 | 21.44s | 5.36s | 9.87s | 0.05s | 20.16s | 0.05s-20.23s TimesheetCont | 8 | 18.67s | 2.33s | 0.85s | 1.34s | 4.22s | 1.33s-4.24s Knowledgebase | 16 | 31.55s | 1.97s | 1.39s | 0.52s | 5.28s | 0.51s-5.31s TimesheetCont | 8 | 12.36s | 1.54s | 1.01s | 0.42s | 2.98s | 0.42s-3.02s GanttsControl | 57 | 1m16s | 1.33s | 1.12s | 0.20s | 5.28s | 0.23s-4.74s ActivitiesCon | 1 | 1.25s | 1.25s | 0.00s | 1.25s | 1.25s | 1.24s-1.29s ProjectsContr | 31 | 25.56s | 0.82s | 0.62s | 0.25s | 3.09s | 0.25s-3.12s IssuesControl | 171 | 2m21s | 0.82s | 0.51s | 0.17s | 3.69s | 0.22s-2.15s IssuesControl | 25 | 19.10s | 0.76s | 0.76s | 0.06s | 3.55s | 0.06s-3.55s ProjectsContr | 4 | 2.91s | 0.73s | 0.14s | 0.58s | 0.91s | 0.57s-0.92s MessagesContr | 3 | 2.08s | 0.69s | 0.55s | 0.06s | 1.05s | 0.06s-1.06s TimelogContro | 21 | 13.69s | 0.65s | 0.77s | 0.11s | 2.83s | 0.11s-2.83s MyController# | 1 | 0.55s | 0.55s | 0.00s | 0.55s | 0.55s | 0.54s-0.56s IssuesControl | 463 | 3m59s | 0.52s | 0.55s | 0.14s | 7.38s | 0.17s-1.99s DocumentsCont | 1 | 0.50s | 0.50s | 0.00s | 0.50s | 0.50s | 0.50s-0.51s WelcomeContro | 78 | 37.85s | 0.49s | 0.44s | 0.12s | 2.23s | 0.14s-1.92s MyController# | 160 | 1m05s | 0.41s | 0.33s | 0.09s | 1.81s | 0.09s-1.49s ArticlesContr | 2 | 0.66s | 0.33s | 0.18s | 0.20s | 0.45s | 0.20s-0.46s ContextMenusC | 3 | 0.88s | 0.29s | 0.38s | 0.05s | 0.73s | 0.05s-0.74s TimelogContro | 24 | 5.72s | 0.24s | 0.35s | 0.03s | 1.53s | 0.03s-1.53s -------------------------------------------------------------------------------- Database tim | Hits | Sum | Mean | StdDev | Min | Max | 95 %tile -------------------------------------------------------------------------------- TimesheetCon | 8 | 2m15s | 16.88s | 41.80s | 0.62s | 1m60s | 0.62s-2m01s AccountContr | 3655 | 1m44s | 0.03s | 0.06s | 0.00s | 0.91s | 0.00s-0.28s IssuesContro | 467 | 32.05s | 0.07s | 0.12s | 0.00s | 0.88s | 0.00s-0.54s TimeEntryRep | 2 | 28.53s | 14.27s | 0.86s | 13.66s | 14.88s | 13.52s-14.89s MessagesCont | 3296 | 28.06s | 0.01s | 0.02s | 0.00s | 0.34s | 0.00s-0.05s IssuesContro | 118 | 24.32s | 0.21s | 0.54s | 0.00s | 4.92s | 0.05s-1.89s IssuesContro | 173 | 21.08s | 0.12s | 0.27s | 0.00s | 2.38s | 0.00s-0.92s ProjectsCont | 520 | 16.31s | 0.03s | 0.11s | 0.00s | 1.92s | 0.00s-0.35s IssuesContro | 57 | 16.17s | 0.28s | 0.59s | 0.02s | 4.05s | 0.02s-1.72s TimeEntryRep | 4 | 12.75s | 3.19s | 4.97s | 0.33s | 10.62s | 0.33s-10.79s MyController | 162 | 12.62s | 0.08s | 0.16s | 0.00s | 1.14s | 0.00s-0.76s IssuesContro | 71 | 12.00s | 0.17s | 0.32s | 0.02s | 1.84s | 0.02s-1.35s ProjectsCont | 34 | 10.65s | 0.31s | 0.31s | 0.00s | 1.34s | 0.00s-1.35s AttachmentsC | 169 | 5.44s | 0.03s | 0.08s | 0.00s | 0.95s | 0.00s-0.27s TimesheetCon | 8 | 5.02s | 0.63s | 0.65s | 0.22s | 2.03s | 0.22s-2.05s Knowledgebas | 16 | 4.62s | 0.29s | 0.38s | 0.03s | 1.20s | 0.03s-1.21s IssuesContro | 25 | 4.47s | 0.18s | 0.46s | 0.02s | 2.25s | 0.02s-2.26s WelcomeContr | 126 | 4.03s | 0.03s | 0.20s | 0.00s | 2.20s | 0.00s-0.06s AutoComplete | 48 | 3.79s | 0.08s | 0.19s | 0.00s | 1.06s | 0.00s-1.08s GanttsContro | 57 | 3.67s | 0.06s | 0.10s | 0.00s | 0.52s | 0.00s-0.44s -------------------------------------------------------------------------------- Database tim | Hits | Sum | Mean | StdDev | Min | Max | 95 %tile -------------------------------------------------------------------------------- TimesheetCon | 8 | 2m15s | 16.88s | 41.80s | 0.62s | 1m60s | 0.62s-2m01s TimeEntryRep | 2 | 28.53s | 14.27s | 0.86s | 13.66s | 14.88s | 13.52s-14.89s TimeEntryRep | 4 | 12.75s | 3.19s | 4.97s | 0.33s | 10.62s | 0.33s-10.79s IssuesContro | 1 | 0.70s | 0.70s | 0.00s | 0.70s | 0.70s | 0.70s-0.72s MembersContr | 1 | 0.69s | 0.69s | 0.00s | 0.69s | 0.69s | 0.69s-0.71s TimesheetCon | 8 | 5.02s | 0.63s | 0.65s | 0.22s | 2.03s | 0.22s-2.05s IssuesContro | 1 | 0.55s | 0.55s | 0.00s | 0.55s | 0.55s | 0.54s-0.56s ProjectsCont | 4 | 1.91s | 0.48s | 0.50s | 0.08s | 1.17s | 0.08s-1.19s MyController | 1 | 0.47s | 0.47s | 0.00s | 0.47s | 0.47s | 0.47s-0.48s ContextMenus | 3 | 1.06s | 0.35s | 0.55s | 0.03s | 0.98s | 0.03s-0.99s ProjectsCont | 34 | 10.65s | 0.31s | 0.31s | 0.00s | 1.34s | 0.00s-1.35s Knowledgebas | 16 | 4.62s | 0.29s | 0.38s | 0.03s | 1.20s | 0.03s-1.21s IssuesContro | 57 | 16.17s | 0.28s | 0.59s | 0.02s | 4.05s | 0.02s-1.72s IssuesContro | 118 | 24.32s | 0.21s | 0.54s | 0.00s | 4.92s | 0.05s-1.89s SearchContro | 12 | 2.22s | 0.18s | 0.45s | 0.00s | 1.58s | 0.00s-1.58s IssuesContro | 25 | 4.47s | 0.18s | 0.46s | 0.02s | 2.25s | 0.02s-2.26s IssuesContro | 71 | 12.00s | 0.17s | 0.32s | 0.02s | 1.84s | 0.02s-1.35s TimelogContr | 21 | 3.36s | 0.16s | 0.29s | 0.00s | 1.03s | 0.00s-1.04s ActivitiesCo | 1 | 0.12s | 0.12s | 0.00s | 0.12s | 0.12s | 0.12s-0.13s IssuesContro | 173 | 21.08s | 0.12s | 0.27s | 0.00s | 2.38s | 0.00s-0.92s Process blockers (> 1 sec duration) -------------------------------------------------------------------------------- IssuesController#update.html [PUT] | 75 hits | 18.9% | === IssuesController#index.html [GET] | 68 hits | 17.2% | === IssuesController#show.html [GET] | 60 hits | 15.2% | == GanttsController#show.html [GET] | 31 hits | 7.8% | = IssuesController#create.html [POST] | 25 hits | 6.3% | = WelcomeController#index.html [GET] | 15 hits | 3.8% | = MyController#page.html [GET] | 14 hits | 3.5% | = ProjectsController#index.html [GET] | 14 hits | 3.5% | = KnowledgebaseController#index.html [GET] | 12 hits | 3.0% | AccountController#login.html [GET] | 10 hits | 2.5% | IssuesController#index.html [POST] | 10 hits | 2.5% | MessagesController#show.html [GET] | 8 hits | 2.0% | TimesheetController#index.html [GET] | 8 hits | 2.0% | TimesheetController#report.html [POST] | 8 hits | 2.0% | ProjectsController#show.html [GET] | 7 hits | 1.8% | IssuesController#new.html [GET] | 6 hits | 1.5% | TimelogController#index.html [GET] | 6 hits | 1.5% | ProjectsController#settings.html [GET] | 3 hits | 0.8% | TimeEntryReportsController#report.html [GET] | 2 hits | 0.5% | IssuesController#new.html [POST] | 2 hits | 0.5% | Failed requests -------------------------------------------------------------------------------- ActionController::RoutingError | 36 hits | 100.0% | ============================ Need an expert to analyze your application? Mail to [email protected] or visit us at http://railsdoctors.com. -------------------------------------------------------------------------------- Thanks for using request-log-analyzer!