barttenbrinke / munin-plugins-rails

Collection of munin plugins for ruby on rails server environments
railsdoctors.com
165 stars 34 forks source link

Added parameter for rla log format #7

Closed bradland closed 13 years ago

bradland commented 13 years ago

When passing log data through a pipe, rla's format auto-detection fails. This causes the rails_* munin plugins to fail, as it expects rla to properly auto-detect the log format. As a workaround, I've added a configuration parameter to explicitly specify the log file format.

Statement of problem

tail -n 1000 production.log | request-log-analyzer -

When production.log is a Rails 3 log, rla reports teaser_check_failed for all requests.

tail -n 1000 production.log | request-log-analyzer - --format rails3

When production.log is a Rails 3 log, and format is passed, rla properly processes requests.

Willem indicates that auto-detection when reading from stdin is problematic because we can't simply back-up and start over after detection occurs.

Location in project

Anywhere request-log-analyzer is provided input from tail.

bradland commented 13 years ago

I don't have any Rails 2.x production environments to test this in, so I'm unable to tell if it fails when no parameter is passed. In my environment, it simply fails to parse the log correctly, but the script executes as expected.

barttenbrinke commented 13 years ago

I cleaned up your patch, so that It should not be a problem on any other rails. Could you try it to see if it works?

bradland commented 13 years ago

Looks good. I let it run over the weekend, and our reporting is still solid. Thanks for the quick pull!

barttenbrinke commented 13 years ago

Thanks for your quick pull request :)