Log viewer UI and framework for rack
Ruby JavaScript CSS HTML Shell
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
assets Fix the javascript side of the search results Nov 29, 2017
bin more binstubs May 13, 2014
bower_components - Upgrade ember to 1.13 Aug 12, 2015
lib Make chained loggers readable. Apr 13, 2018
test Fix race condition for search results that get returned out-of-order Nov 27, 2017
vendor/assets/javascripts Refactor configuration, put grouping behind config gate Jun 22, 2015
website update dependencies May 6, 2018
.gitignore Update gitignore file Nov 21, 2016
.travis.yml Bump Ruby versions on Travis. Oct 27, 2017
CHANGELOG.md Revert "Release 1.2.10." Dec 4, 2017
Gemfile Initial commit Apr 28, 2014
Guardfile Work in progress logging framework Apr 28, 2014
LICENSE.txt
README.md Extract changelog to its own file. Dec 1, 2017
Rakefile - Upgrade ember to 1.13 Aug 12, 2015
bower.json - Upgrade ember to 1.13 Aug 12, 2015
logster.gemspec Add callbacks trigger by log rate per min and hour. Feb 18, 2016

README.md

logster logo

Logster is an embedded Ruby "exception reporting service" admins can view on live websites, at http://example.com/logs

Interface

Screenshot

Play with a live demo at logster.info/logs.

Installation

Add these lines to your application's Gemfile:

gem 'redis'
gem 'logster'

And then execute:

$ bundle

Make logster web available add the following to your routes.rb:

constraints lambda { |req| req.session["admin"] } do
  mount Logster::Web => "/logs"
end

By default, logster will only run in development and production environments.

To run logster in other environments, in config/application.rb

Logster.set_environments([:development, :staging, :production])

Tracking Error Rate

Logster allows you to register a callback when the rate of errors has exceeded a given limit.

Tracking buckets available are one minute and an hour.

Example:

Logster.register_rate_limit_per_minute(Logger::WARN, 60) do |rate|
  puts "O no! The error rate is now #{rate} errors/min"
end

Logster.register_rate_limit_per_hour([Logger::WARN, Logger::ERROR, Logger::FATAL], 60) do |rate|
  puts "O no! The error rate is now #{rate} errors/hour"
end

Note

If you are seeing the error No such middleware to insert before: ActionDispatch::DebugExceptions after installing logster, then you are using a conflicting gem like better_errors or web-console.

To avoid this error, make sure logster is added behind those conflicting gems in your Gemfile.

Mount using warden (devise)

  admin_constraint = lambda do |request|
    request.env['warden'].authenticate? and request.env['warden'].user.admin?
  end

  constraints admin_constraint do
    mount Logster::Web, at: "/logs"
  end

Out of the box, logster will use the default redis connection, to customise, in config/application.rb

Logster.store = Logster::RedisStore.new(redis_connection)

Heroku Deployment

In case you may be using the rails_12factor gem in a production deployment on Heroku, the standard Rails.logger will not cooperate properly with Logster. Extend Rails.logger in your config/application.rb or config/initializers/logster.rb with:

if Rails.env.production?
    Rails.logger.extend(ActiveSupport::Logger.broadcast(Logster.logger))
end

Thanks

Logster UI is built using Ember.js

Contributing

  1. Fork it ( https://github.com/discourse/logster/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request