Techblog

Tech Blog

Our latest geek adventures!

29 August Rails-log-analyzer matures

Since I announced rails-log-analyzer some weeks ago, quite a lot has happened! Apparently there is some interest in such a tool: on this blog we get a lot of traffic looking for more info, the github project already has 22 watchers and it even has been forked!

In the mean time, Bart and I worked hard to add new functionality and refactored the internal design. As a result, I have released request-log-analyzer 0.1.0 today!

Changes: 

  • The project is renamed to request-log-analyzer, because we plan to support log files from other frameworks as well; Merb is planned to be supported in the near future.
  • The tool is distributed as a gem, making it much easier to install and update.
  • More reports, colorized output, parsing progress bars, command line arguments, etc…
  • Added a tool to create a SQLite database with all the parsed info from the log file, so you can do your own analysis.

Installation:

gem sources -a http://gems.github.com
sudo gem install wvanbergen-request-log-analyzer

Usage:

request-log-analyzer  [LOG FILES*]
request-log-analyzer -c 20 -z log/production.log

Please let me know what you think! If you have any problems using the tool, do not hesitate to contact me!

Tags: , , , ,

13 Responses to “Rails-log-analyzer matures”

  1. Rails log analyzer matures : businessuu Says:

    [...] Original post by Willem van Bergen [...]

  2. mySelf Says:

    Hey,

    can you describe how to run your gem with windows?
    A simple request-log-analyzer [LOG FILES*] on the windows command prompt will not work.

    Thanks in advance!

  3. Willem van Bergen Says:

    Sorry for the late reply; I was on a holiday.

    Unfortunately, I don’t have a Windows installation to test it on: you may be the first person to use this tool on Windows :-) . What error message do you get when you run request-log-analyzer?

    You may need to call the Ruby interpreter directly, because Windows does not support the executable file permission, but you’ll need to find out where the request-log-analyzer file is installed on your system:
    ruby c:\path\to\request-log-analyzer c:\railsapp\log\development.log

    Hope this helps!

  4. vivek Says:

    I’m trying to intall this with windows.Not sure if i’m trying to install it right – gem sources -a http://gems.github.com
    sudo gem install wvanbergen-request-log-analyzer

    please advice..

    thanks

  5. Willem van Bergen Says:

    The commands you posted works for me. However, I only have used the tool on OSX and Linux and I have never used in in Windows, so it might not even work for you at all.

    Can you post the error message you are experiencing? Any additional information you can provide might help me solving this issue.

  6. Rian Awi Says:

    Does this work with rails 2.1? As I tried this out with rails 2.1 production log, it gave ‘Unparsable completed line: Completed in 10ms (View: 0, DB: 3) | 200 OK [http://mywebsite.com/] for all lines parsed. With development log, it could parse only some lines.

  7. Willem van Bergen Says:

    As of yet, it does not work with this new log format. I am working on making request-log-analyzer compatible, because we need it for Floorplanner as well. I will release an update in the upcoming days, so keep an eye on the github project.

  8. Willem van Bergen Says:

    I have made the necessary changes to support the new log format.
    You can find them in the rails22 branch of the github project. After some testing, I will merge the changes to the master branch and publish an updated gem.

  9. Mark Says:

    Willem,

    This is a really excellent tool! Well done and thanks for sharing.

    Cheers,
    Mark

  10. Willem van Bergen Says:

    Hey Mark, glad you like it! Don’t hesitate to contact me if you have any questions.

  11. Nils Says:

    I have the the Request-log-analyzer version 1.1 (and 1.1.5.1) installed and it seems to mix up the view times with the DB times for my rails 2.2 app

    Database time – I have the following entry

    DownloadsController#report.xml [P ┃ 302 ┃ 0.00s ┃ 0.00s ┃ 0.00s ┃ 0.00s

    View rendering time - I see the following entry

    DownloadsController#report.xml [ ┃ 302 ┃ 300.15s ┃ 0.99s ┃ 0.00s ┃ 12.45s

    But if I grep the log file, the only reference to 12.45 seconds I can find is the following:

    Completed in 12458ms (View: 0, DB: 12451) | 200 OK [http://publisher.peerialism.com/downloads/report.xml]

    So the times seems to be mixed up

    Cheers,
    Nils

  12. Willem van Bergen Says:

    Nice catch! I looked it up in the code, and I found that the titles above these tables are switched. Internally, the values are parsed correctly. I will fix this mistake this weekend.

  13. Willem van Bergen Says:

    It has been fixed. Please upgrade to version 1.1.6 to have the correct table headers names in your report.

Leave a Reply