Sha256: 1321d50777bb9865267159bc1061afacd9096c83166fd22fd9498da2f0d31bfb

Contents?: true

Size: 640 Bytes

Versions: 8

Compression:

Stored size: 640 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 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
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fluent-plugin-elasticsearch-2.7.0 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-2.6.1 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-2.6.0 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-2.5.0 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-2.4.1 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-2.4.0 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-2.3.0 lib/fluent/plugin/generate_hash_id_support.rb
fluent-plugin-elasticsearch-2.2.0 lib/fluent/plugin/generate_hash_id_support.rb