Sha256: 75a6afb77afe4f2e6b79d93ba8374ca93f39701742a35b18180af4bc65954fc0

Contents?: true

Size: 593 Bytes

Versions: 3

Compression:

Stored size: 593 Bytes

Contents

# encoding: utf-8
require "logstash/filters/base"
require "logstash/namespace"

class LogStash::Filters::Unique < LogStash::Filters::Base
  config_name "unique"

  # The fields on which to run the unique filter.
  config :fields, :validate => :array, :required => true

  public
  def register
    # Nothing to do
  end # def register

  public
  def filter(event)
    @fields.each do |field|
      next unless event.include?(field)
      next unless event.get(field).is_a?(Array)
      event.set(field, event.get(field).uniq)
    end
  end # def filter

end # class LogStash::Filters::Unique

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
logstash-filter-unique-3.0.0 lib/logstash/filters/unique.rb
logstash-filter-unique-sbt-3.0.0 lib/logstash/filters/unique.rb
logstash-filter-unique2-3.0.0 lib/logstash/filters/unique.rb