Skip to content

Commit

Permalink
Docs: Rewrite to correctly describe the plugin's purpose.
Browse files Browse the repository at this point in the history
Previously it was stated that this plugin is useful for generating
consistent strings and avoiding duplicates in Elasticsearch, which
is totally wrong.

Also use 'uuid' as an example target field name instead of '@uuid' since
@-prefixed field names are reserved.

Fixes #7
  • Loading branch information
magnusbaeck authored and suyograo committed Aug 8, 2016
1 parent 456b857 commit 8f949a8
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions lib/logstash/filters/uuid.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,31 @@
require "logstash/namespace"
require "securerandom"

# 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
# The uuid filter allows you to generate a
# https://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
# https://tools.ietf.org/html/rfc4122[RFC 4122]) and will be
# represented as a standard hexadecimal string format, e.g.
# "e08806fe-02af-406c-bbde-8a5ae4475e57".
class LogStash::Filters::Uuid < LogStash::Filters::Base
config_name "uuid"

# Add a UUID to a field.
# Select the name of the field where the generated UUID should be
# stored.
#
# Example:
# [source,ruby]
# filter {
# uuid {
# target => "@uuid"
# target => "uuid"
# }
# }
config :target, :validate => :string, :required => true
Expand All @@ -30,7 +40,7 @@ class LogStash::Filters::Uuid < LogStash::Filters::Base
# [source,ruby]
# filter {
# uuid {
# target => "@uuid"
# target => "uuid"
# overwrite => true
# }
# }
Expand Down

0 comments on commit 8f949a8

Please sign in to comment.