class LogStash::Outputs::ArangoDB

Public Instance Methods

flush(events, params, final=false) click to toggle source
# File lib/logstash/outputs/arangodb.rb, line 74
def flush(events, params, final=false)
  events.each do |event|
    collection(event).create_document(event.to_hash)
  end
end
receive(event) click to toggle source
# File lib/logstash/outputs/arangodb.rb, line 65
def receive(event)
  return unless output?(event)
  buffer_receive(event, :server => @host)
end
register() click to toggle source
# File lib/logstash/outputs/arangodb.rb, line 46
def register

  @host = Socket.gethostname.force_encoding(Encoding::UTF_8)

  @database = Ashikawa::Core::Database.new do |config|
    config.url = @url
    config.database_name = @database if @database
    config.username = @username
    config.password = @password.value
  end

  buffer_initialize(
    :max_items => @flush_size,
    :max_interval => @idle_flush_time,
    :logger => @logger
  )

end
teardown() click to toggle source
# File lib/logstash/outputs/arangodb.rb, line 70
def teardown
  buffer_flush(:final => true)
end

Private Instance Methods

collection(event) click to toggle source
# File lib/logstash/outputs/arangodb.rb, line 82
def collection(event)
  @database[event.sprintf(@collection)]
end