Sha256: d3a7f4bbcf8e508dfabfe632589e082bc94cd508ff82a2bdd38d4893f2982bc8

Contents?: true

Size: 991 Bytes

Versions: 4

Compression:

Stored size: 991 Bytes

Contents

require 'fluent/mixin/rewrite_tag_name'

class Fluent::TypeConverterMixinOutput < Fluent::Output
  Fluent::Plugin.register_output('type_converter_mixin', self)

  config_param :tag, :string, :default => nil
  config_param :types, :string, :default => nil
  config_param :types_delimiter, :string, :default => ','
  config_param :types_label_delimiter, :string, :default => ':'

  include Fluent::HandleTagNameMixin
  include Fluent::Mixin::RewriteTagName
  include Fluent::Mixin::TypeConverter

  def configure(conf)
    super

    if ( !@tag && !@remove_tag_prefix && !@remove_tag_suffix && !@add_tag_prefix && !@add_tag_suffix )
      raise Fluent::ConfigError, "RewriteTagNameMixin: missing remove_tag_prefix, remove_tag_suffix, add_tag_prefix or add_tag_suffix."
    end
  end

  def emit(tag, es, chain)
    es.each do |time, record|
      emit_tag = tag.dup
      filter_record(emit_tag, time, record)
      Fluent::Engine.emit(emit_tag, time, record)
    end
    chain.next
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fluent-mixin-type-converter-0.0.4 test/plugin.rb
fluent-mixin-type-converter-0.0.3 test/plugin.rb
fluent-mixin-type-converter-0.0.2 test/plugin.rb
fluent-mixin-type-converter-0.0.1 test/plugin.rb