Class: LogStash::Filters::Uuid
- 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
Constants included from Config::Mixin
Instance Attribute Summary
Attributes included from Config::Mixin
Attributes inherited from Plugin
Instance Method Summary collapse
Methods inherited from Base
#execute, #initialize, #threadsafe?
Methods included from Config::Mixin
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 |
#register ⇒ Object
41 42 |
# File 'lib/logstash/filters/uuid.rb', line 41 def register end |