Class: Steno::Sink::Fluentd

Inherits:
Base show all
Defined in:
lib/steno/sink/fluentd.rb

Overview

Instance Attribute Summary

Attributes inherited from Base

#codec

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Fluentd

Returns a new instance of Fluentd.

Parameters:

  • opts (Hash) (defaults to: {})

    Key :tag_prefix tag prefix of fluent logs (default: steno) Key :host fluentd host (default: 127.0.0.1) Key :port fluentd port (deafult: 24224) Key :buffer_limit buffer limit of fluent-logger



14
15
16
17
18
19
20
21
22
# File 'lib/steno/sink/fluentd.rb', line 14

def initialize(opts = {})
  super

  @fluentd = Fluent::Logger::FluentLogger.new(opts[:tag_prefix] || "steno",
    :host => opts[:host] || "127.0.0.1",
    :port => opts[:port] || 24224,
    :buffer_limit => opts[:buffer_limit] || Fluent::Logger::FluentLogger::BUFFER_LIMIT)
  @io_lock = Mutex.new
end

Instance Method Details

#add_record(record) ⇒ Object



24
25
26
# File 'lib/steno/sink/fluentd.rb', line 24

def add_record(record)
  @fluentd.post(record.source, record)
end

#flushObject



28
29
30
# File 'lib/steno/sink/fluentd.rb', line 28

def flush
  nil
end