class LogStash::Filters::Uuid
The uuid filter allows you to generate a en.wikipedia.org/wiki/Universally_unique_identifier[UUID] and add it as a field to each processed event.
This is useful if you need to generate a string that's unique for every event, even if the same input is processed multiple times. If you want to generate strings that are identical each time a event with a given content is processed (i.e. a hash) you should use the <<plugins-filters-fingerprint,fingerprint filter>> instead.
The generated UUIDs follow the version 4 definition in tools.ietf.org/html/rfc4122[RFC 4122]) and will be represented as a standard hexadecimal string format, e.g. “e08806fe-02af-406c-bbde-8a5ae4475e57”.
Public Instance Methods
filter(event)
click to toggle source
# File lib/logstash/filters/uuid.rb, line 54 def filter(event) # SecureRandom.uuid returns a non UTF8 string and since # only UTF8 strings can be passed to a LogStash::Event # we need to reencode it here if overwrite event.set(target, SecureRandom.uuid.force_encoding(Encoding::UTF_8)) elsif event.get(target).nil? event.set(target, SecureRandom.uuid.force_encoding(Encoding::UTF_8)) end filter_matched(event) end
register()
click to toggle source
# File lib/logstash/filters/uuid.rb, line 50 def register end