Sha256: eab890fef959daf8eca5c7b75dbe0aed0afd575670c3dbe1106f1576f6763db0

Contents?: true

Size: 577 Bytes

Versions: 9

Compression:

Stored size: 577 Bytes

Contents

require "logstash/outputs/base"
require "logstash/namespace"
require "em-mongo"

class LogStash::Outputs::Mongodb < LogStash::Outputs::Base
  public
  def register
    # TODO(sissel): Port?
    # TODO(sissel): Authentication?
    # db and collection are mongodb://.../db/collection
    unused, @db, @collection = @url.path.split("/", 3)
    @mongodb = EventMachine::Mongo::Connection.new(@url.host).db(@db)
  end # def register

  public
  def receive(event)
    @mongodb.collection(@collection).insert(event.to_hash)
  end # def receive
end # class LogStash::Outputs::Mongodb

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
logstash-lite-0.2.20110505142231 lib/logstash/outputs/mongodb.rb
logstash-lite-0.2.20110422152244 lib/logstash/outputs/mongodb.rb
logstash-lite-0.2.20110405105201 lib/logstash/outputs/mongodb.rb
logstash-lite-0.2.20110331121236 lib/logstash/outputs/mongodb.rb
logstash-lite-0.2.20110329105411 lib/logstash/outputs/mongodb.rb
logstash-lite-0.2.20110206003603 lib/logstash/outputs/mongodb.rb
logstash-lite-0.2.20110203130400 lib/logstash/outputs/mongodb.rb
logstash-lite-0.2.20110122143801 lib/logstash/outputs/mongodb.rb
logstash-lite-0.2.20110112115019 lib/logstash/outputs/mongodb.rb