Module: Fluent::Plugin::GenerateHashIdSupport

Included in:
ElasticsearchOutput, ElasticsearchOutputDynamic
Defined in:
lib/fluent/plugin/generate_hash_id_support.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(klass) ⇒ Object



7
8
9
10
11
12
13
14
# File 'lib/fluent/plugin/generate_hash_id_support.rb', line 7

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

Instance Method Details

#generate_hash_id_key(record) ⇒ Object



16
17
18
19
20
21
# File 'lib/fluent/plugin/generate_hash_id_support.rb', line 16

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