Switch branches/tags
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
59 lines (47 sloc) 2.84 KB


RailsAnalyzer generates reports about requests processed by a Ruby on Rails server.

It analyzes the log files created by a Rails server. It can accept any number of files as its command line parameters. It defaults to use 'log/production.log' as its input when no filenames are provided.

Two different reporting engines process the log files:

  • TimeStats, which is concerned with when the request was made. It produces reports with the amount of hits recorded in the log file per time interval, and the relative amount of requests within a time interval. The relative interval simply lowers all hit counts until one hits zero. This makes it easy to filter out periodic requests.

  • HitStats, which is concerned with how fast the requests were handled. It produces reports with detailed time statistics for each request. It has two types of reports: with params and without params. Each type of report produces a number of files, each which is sorted by one of the following statistics for responses: fastest, slowest, sum, average, median, standard deviation and hit count.

Both engines produce .txt files as their only output.

  • TimeStats produces log_times_*.txt and log_times_*_relative.txt output.

  • HitStats produces the other log_*.txt and log_*_with_params.txt files.

Recent changes

Version 0.2.2

Added reports for slowest and fastest requests. Documentation updates.

Version 0.2.1


  • HitStats reports were not generated. They are working again.

  • Array#median always returns a float to prevent integer math (lack of) rounding problems.


  • No longer rely on ActiveSupport. It was used for Array#sum and Array#group_by, which are now implemented in ArrayExt.


  • Parts of UrlHits and Entries got specs to help debugging the HitStats bug.

  • Added specs for all ArrayExt methods.

Version 0.2.0

Split single-file script into one file per existing class. Introduced new classes to handle responsibilities that were not yet handled. Changed classes involved in generating URL hits-based reports to be more flexible. Generally refactored a lot of non-DRY code to be at least a bit nicer.

Version 0.1.0

Imported single-file script


From gem

The gem is located on github.

gem install Narnach-rails_analyzer -s

From git

From the project root, use rake to install:

git clone git://
cd rails_analyzer
rake install

This will build the gem and install it for you.


rails_analyzer [log_file1] [log_file2] [..] [log_fileN]

When no log files are provided, log/production.log is used.



Wes 'Narnach' Oldenbeuving (



Copyright © 2008 Wes Oldenbeuving


MIT license. See MIT-LICENSE (in the gem directory) for license details.