Sha256: 2de47c62df0e291cf09114599c1a863f33da121fe4651c2b32e4b9a81966d74f

Contents?: true

Size: 499 Bytes

Versions: 3

Compression:

Stored size: 499 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: '_id'
        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

3 entries across 3 versions & 1 rubygems

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