Skip to content
This repository was archived by the owner on Dec 4, 2021. It is now read-only.

Mongodblogger settings

le0pard edited this page Apr 3, 2013 · 10 revisions

MongodbLogger settings

In this page explained each parameter of MongodbLogger settings.

database

Default: not provided, required.

Name of MongoDB database, where was created collection for store logs. If you using Mongoid, when MongodbLogger will use Mongoid database (if you not setup mongodb_logger.yml).

Example:

database: my_app

capsize

Default: 250 MB

For logging into MongoDB, MongodbLogger use special type of collection - capped collections (More info). Capped collections provide a high-performance means for storing logging documents in the database. Inserting objects in an unindexed capped collection will be close to the speed of logging to a filesystem. Additionally, with the built-in FIFO mechanism, you are not at risk of using excessive disk space for the logging. This params setup size of capped collection.

Example:

capsize: <%= 100.megabytes %> # set 100 MB

host

Default: localhost

This parameter give information, how to connect to MongoDB.

port

Default: 27017

This parameter give information, how to connect to MongoDB.

username

Default: not provided

Auth username.

password

Default: not provided

Auth password.

replica_set

Default: false

If you have several MongoDB in replication, this parameter should be in "true" state. In this case, if master of MongoDB will down, the MongodbLogger will try reconnect to new MongoDB master.

write_options

Default: {w: 0, wtimeout: 200}

This parameter set write concern for mongo adapter. More information you can read here.

application_name

Default: Rails.application

This parameter set application_name in log. This parameter can be usefull, if you have several web nodes, which write logs in same storage and want to know, what node write this log.

disable_file_logging

Default: false

By default MongodbLogger does not block the regular logging to file. If you want to log ONLY to MongoDB without logging to file, then set this parameter "true".

collection

Default: Rails.env + "_log"

By default MongodbLogger create and write logs into "#{Rails.env}_log" collection. By this parameter you can customize name of using collection.

url

Default: not provided

Initialize a connection to MongoDB using the MongoDB URI spec. The URI must fit this specification:

mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]

ssl

Default: false

Set to true to use SSL when connecting to MongoDB.