Plog

Ruby on Rails production log statistics generator.

by Kazuyoshi Tlacaelel.

$ plog my_directory_with_production_logs/
$ ls plog/
objects     statistics.txt

Copyright © 2009 Kazuyoshi Tlacaelel. See LICENSE for details.

Comming soon!

comming soon to a terminal near you!

* sorting:
* more statistics
  (hits, number of hits per response type like 200, 302 etc)

May be… but don’t expect any of these to become a reality I love programming and tons of ideas flow in my head with posibilities but I do not have the time! :(

* Different export drivers?
  (should be another plugin)

* cli options abstracted into classes so they can be aggregated with ease
  (this might be cool)

* google charts integration
  (is too much for this api)
  (may be as a different plugin)

Dependancies:

* FileUtils
* MD5
* File
* Dir
* URI
* rubygems 1.3.3

Features:

Compiles statistics in a easy to read manner

Hits      Time      Avg-Time  DbTime    Avg-DB    View      Avg-View  Url
93        18057     0.194     5775      0.062     10437     0.112     /users/[0-9]
12        277       0.023     193       0.016     0         0         /user_themes/update
1         290       0.29      107       0.107     175       0.175     /posts
3         99        0.033     57        0.019     0         0         /comments
82        11922     0.145     5969      0.072     4979      0.06      /user/[0-9]/comments
1868      1301006   0.696     623246    0.333     491474    0.263     /user/[0-9]/posts?
1         72        0.072     39        0.039     0         0         /confirm_destroy_account/[0-9]?
797       971882    1.219     414829    0.52      423130    0.53      /user/[0-9]/articles/friends?
122       20830     0.17      7081      0.058     10291     0.084     /user/[0-9]/topics?

Installation

$ gem sources -a http://gems.github.com
$ gem install ktlacaelel-plog

Known bugs:

none, so far..

License:

MIT. See the "LICENSE" file for details.

Participate

  • Send me a brief message

  • Fork the project.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Make your feature addition or bug fix.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but

    bump version in a commit by itself I can ignore when I pull)
    
  • Send me a pull request. Bonus points for topic branches.

Output:

All output is packed in a plog directory, from wherever you run the “plog” executable.

Inside this directory you’ll find a directory called objects. wich contains many small files called “object-files” this files contain all the parsed statistics of you log files.

The information is scattered and can be reused for future compilations meaning that new compilations data will merge with the existing one.

all data in these “object-files” is read and summarized into a statistics.txt file found inside of the plog directory.

Tests:

* 70% tested, with shoulda
* all core areas of the api are tested, and tests pass!
* only the cli part of the api has no tests, but will be implemented soon

Usage:

The “plog” ( production log ) executable receives one option. This must be a directory containing one or more production logs. Only logs in the first level will be parsed. Recursive reading is not allowed

$ plog directory_with_logs/

Works on:

* OSX Darwin utopia.local 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
* UBUNTU Linux utopia.local 2.6.28-11-server #42-Ubuntu SMP Fri Apr 17 02:45:36 UTC 2009 x86_64 GNU/Linux

* OSX ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0]
* UBUNTU ruby 1.8.7 (2009-06-12 patchlevel 174) [x86_64-linux]

* rubygems 1.3.4
* rubygems 1.3.3

The end.