MongodbLogger is an alternative logger for Rails or Rack based app, it logs all your application's requests into MongoDB database.


Simple Integration

It's really simple to integrate MongodbLogger into existing Rails applications.

Store & Search

MongodbLogger allows to store all logs from web clusters into one scalable storage - MongoDB. It's flexible schema allows to search and store any kind of informations from logs.

Web Interface

Web panel allows to filter logs and gets analytics data from logs with help of MapReduce.

Demo Application

Press this button and you can see Rails application with MongodbLogger.

Let's look

The Front End

Log List

Log List

Log Filters

Log Filters

Log Analytic

Log Details

Getting Started

  1. Add the following to your Gemfile then refresh your dependencies by executing "bundle install" (or just simple "bundle"):

    gem "mongodb_logger"

    or install by rubygems

    gem install mongodb_logger
  2. Add adapter in Gemfile. Supported mongo and moped (mongoid). For example:

    gem "mongo"
    gem "bson_ext" # for MRI


    gem "moped"
  3. Add the following line to your ApplicationController:

    include MongodbLogger::Base
  4. Add MongodbLogger settings to database.yml for each environment in which you want to use the MongodbLogger. The MongodbLogger will also look for a separate mongodb_logger.yml or mongoid.yml (if you are using mongoid) before looking in database.yml. In the mongodb_logger.yml and mongoid.yml case, the settings should be defined without the 'mongodb_logger' subkey. Example mongodb_logger.yml:

      database: my_app
      capsize: <%= 500.megabytes %>
      host: localhost
      port: 27017
      replica_set: true
  5. To setup web interface in you Rails application, first of all create autoload file in you Rails application (create file in "config/initializers/" directory):

    require 'mongodb_logger/server' # required
    # this secure you web interface by basic auth, but you can skip this, if you no need this
    MongodbLogger::Server.use Rack::Auth::Basic do |username, password|
      [username, password] == ['admin', 'password']

    and mount web in Rails routes:

    mount MongodbLogger::Server.new, :at => "/mongodb"
Fork me on GitHub