rack-mlog¶ ↑
rack-mlog is a rack middleware to provide statistics and request logging via a MongoDB Database.
gem install rack-mlog
Example config.ru:
require 'rack/mongolog' use Rack::MongoLog run MyApp.new
Example config.ru with a custom MongoDB:
require 'rack/mongolog' use Rack::MongoLog :uri => 'mongodb://user:pass@flame.mongohq.com:27051/mysite' run MyApp.new
Since this is a rack middleware it is fully compatible with any other rack compatible framework such as sinatra, rails, etc. It also works on heroku with MongoHQ.
mlog Configuration¶ ↑
-
:uri - This is the URI of the MongoDB, such as: ‘mongodb://user:pass@flame.mongohq.com:27051/mysite`
-
:collection - To specify a collection to use, default is ‘mlog`
-
:map - This is a Hash including key’s to map into the Hash saved on the MongoDB collection, any maps here will be added to the default maps. This allows you to add into rack-mlog, such as adding a authenticated user onto the collection.