Sha256: 52416b41059b0c900a749f0328d9bcb636911dde0bdff41bfea93d19126e40d7

Contents?: true

Size: 680 Bytes

Versions: 6

Compression:

Stored size: 680 Bytes

Contents

require 'observed/fluentd/version'
require 'observed/reporter'
require 'observed/reporter/regexp_matching'
require 'fluent-logger'

module Observed
  module Plugins
    class Fluentd < Observed::Reporter

      include Observed::Reporter::RegexpMatching

      plugin_name 'fluentd'

      attribute :tag
      attribute :host
      attribute :port, default: 24224
      attribute :transform, default: ->(data){ data }

      def report(tag, time, data)
        fluent_logger.post(self.tag, transform.call(data))
      end

      private

      def fluent_logger
        @fluent_logger ||= Fluent::Logger::FluentLogger.new(nil, host: host, port: port)
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
observed-fluentd-0.2.0 lib/observed/fluentd.rb
observed-0.2.0 plugins/observed-fluentd/lib/observed/fluentd.rb
observed-0.2.0.rc2 plugins/observed-fluentd/lib/observed/fluentd.rb
observed-0.2.0.rc1 plugins/observed-fluentd/lib/observed/fluentd.rb
observed-0.1.1 plugins/observed-fluentd/lib/observed/fluentd.rb
observed-fluentd-0.1.0 lib/observed/fluentd.rb