Sha256: 7348be84fbbf42a428642fe4ff5f33943db1da6d696d7e4e0826cd7ae4fb8150
Contents?: true
Size: 912 Bytes
Versions: 1
Compression:
Stored size: 912 Bytes
Contents
module Fluent class MongoOutput < Output Fluent::Plugin.register_output('mongo', self) def initialize super require 'mongo' end def configure(conf) super raise ConfigError, "'database' parameter is required on file output" unless @database = conf['database'] raise ConfigError, "'collection' parameter is required on file output" unless @collection = conf['collection'] @host = conf.has_key?('host') ? conf['host'] : 'localhost' @port = conf.has_key?('port') ? conf['port'] : 27017 end def start super @collection = Mongo::Connection.new(@host, @port).db(@database).collection(@collection) end def shutdown # Mongo::Connection checks alive or closed myself @collection.db.connection.close end def emit(tag, event_stream, chain) event_stream.each { |event| @collection.insert(event.record) } chain.next end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-mongo-0.1.0 | lib/fluent/plugin/out_mongo.rb |