Sha256: 5298128d9b6184b49e4a641db063977f648325b8541a3578574f78abe0190e8a

Contents?: true

Size: 594 Bytes

Versions: 1

Compression:

Stored size: 594 Bytes

Contents

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

class LogStash::Filters::Unique < LogStash::Filters::Base

  config_name "unique"
  milestone 1

  # 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)
    return unless filter?(event)

    @fields.each do |field|
      next unless event[field].class == Array

      event[field] = event[field].uniq
    end
  end # def filter

end # class Logstash::Filters::Unique

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
logstash-lib-1.3.2 lib/logstash/filters/unique.rb