Sha256: e67aafe269c61d9652ffd57cdd1c81892c0a7a26d5bdcfb5799eadfea17fd875

Contents?: true

Size: 644 Bytes

Versions: 2

Compression:

Stored size: 644 Bytes

Contents

require 'fluent/plugin/rename_key_util'

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

  include Fluent::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)

    raise Fluent::ConfigError, "No rename or replace rules are given" if @rename_rules.empty? && @replace_rules.empty?
  end

  def filter tag, time, record
    new_record = rename_key record
    new_record = replace_key new_record
    new_record
  end
end if defined?(Fluent::Filter)

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fluent-plugin-rename-key-0.3.4 lib/fluent/plugin/filter_rename_key.rb
fluent-plugin-rename-key-0.3.3 lib/fluent/plugin/filter_rename_key.rb