Sha256: 919e605cece0d821c3322760f08aeddb76f4a2f09537c9561c2291420dc23749

Contents?: true

Size: 587 Bytes

Versions: 4

Compression:

Stored size: 587 Bytes

Contents

require 'securerandom'
require 'base64'

module Fluent
  module GenerateHashIdSupport
    def self.included(klass)
      klass.instance_eval {
        config_section :hash, param_name: :hash_config, required: false, multi: false do
          config_param :hash_id_key, :string, default: '_hash',
                       obsoleted: "Use bundled filter-elasticsearch-genid instead."

        end
      }
    end

    def generate_hash_id_key(record)
      s = ""
      s += Base64.strict_encode64(SecureRandom.uuid)
      record[@hash_config.hash_id_key] = s
      record
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fluent-plugin-elasticsearch-1.13.2 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-1.13.1 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-1.13.0 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-1.12.0 lib/fluent/plugin/generate_hash_id_support.rb