Sha256: 4db9f397e35a7eaa6f3cf30203c7aebe1f92bb68b0f3570fc9046708afb1c851
Contents?: true
Size: 971 Bytes
Versions: 1
Compression:
Stored size: 971 Bytes
Contents
# encoding: utf-8 require "logstash/filters/base" require "logstash/namespace" # Strip everything but punctuation from a field and store the remainder in the # a separate field. This is often used for fingerprinting log events. class LogStash::Filters::Punct < LogStash::Filters::Base config_name "punct" milestone 1 # The field reference to use for punctuation stripping config :source, :validate => :string, :default => "message" # The field to store the result. config :target, :validate => :string, :default => "punct" public def register # Nothing to do end # def register public def filter(event) return unless filter?(event) original_value = event[@source] # If for some reason the field is an array of values, take the first only. original_value = original_value.first if original_value.is_a?(Array) event[@target] = original_value.tr('A-Za-z0-9 \t','') end # def filter end # class LogStash::Filters::Punct
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
logstash-lib-1.3.2 | lib/logstash/filters/punct.rb |