Sha256: 9b5922156293e1f45776292076279ddf5205f70cea0dd60b68e69b9da485dda3

Contents?: true

Size: 639 Bytes

Versions: 1

Compression:

Stored size: 639 Bytes

Contents

require 'securerandom'
require 'base64'

module Fluent
  module Plugin
    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 filer-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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fluent-plugin-elasticsearch-2.2.0.rc.1 lib/fluent/plugin/generate_hash_id_support.rb