Class: LogStash::Filters::Uuid

Inherits:
Base show all
Defined in:
lib/logstash/filters/uuid.rb

Overview

The uuid filter allows you to add a UUID field to messages. This is useful to be able to control the _id messages are indexed into Elasticsearch with, so that you can insert duplicate messages (i.e. the same message multiple times without creating duplicates) - for log pipeline reliability

Constant Summary

Constants inherited from Base

Base::RESERVED

Constants included from Config::Mixin

Config::Mixin::CONFIGSORT

Instance Attribute Summary

Attributes included from Config::Mixin

#config, #original_params

Attributes inherited from Plugin

#logger, #params

Instance Method Summary collapse

Methods inherited from Base

#execute, #initialize, #threadsafe?

Methods included from Config::Mixin

#config_init, included

Methods inherited from Plugin

#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s

Constructor Details

This class inherits a constructor from LogStash::Filters::Base

Instance Method Details

#filter(event) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
# File 'lib/logstash/filters/uuid.rb', line 45

def filter(event)
  return unless filter?(event)

  if overwrite
    event[target] = SecureRandom.uuid
  else
    event[target] ||= SecureRandom.uuid
  end

  filter_matched(event)
end

#registerObject



41
42
# File 'lib/logstash/filters/uuid.rb', line 41

def register
end