Sha256: 4424d2ebe83fd511e9c45d5751d1c536a27fe651c8d2f556577c1208a3742f7b

Contents?: true

Size: 629 Bytes

Versions: 2

Compression:

Stored size: 629 Bytes

Contents

require 'fluent/plugin/filter'
require 'fluent/plugin/rename_key_util'

class Fluent::Plugin::RenameKeyFilter < Fluent::Plugin::Filter
  Fluent::Plugin.register_filter 'rename_key', self

  include Fluent::Plugin::RenameKeyUtil

  desc 'Deep rename/replace operation.'
  config_param :deep_rename, :bool, default: true

  def configure conf
    super

    create_rename_rules(conf)
    create_replace_rules(conf)

    if @rename_rules.empty? && @replace_rules.empty?
      raise Fluent::ConfigError, 'No rename nor replace rule given'
    end
  end

  def filter _tag, _time, record
    replace_key(rename_key(record))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-rename-key-0.4.1 lib/fluent/plugin/filter_rename_key.rb
fluent-plugin-rename-key-0.4.0 lib/fluent/plugin/filter_rename_key.rb