Sha256: 986481112cfb5d0cbbffe18753978b02ce0da6b6bfa0d9c34fd90834094a72e1
Contents?: true
Size: 789 Bytes
Versions: 4
Compression:
Stored size: 789 Bytes
Contents
# { # "gsub": { # "field": "", # "match": "", # "replace": "" # } # } module Anschel class Filter def gsub conf, log field = conf.delete :field match = Regexp.new conf.delete(:match) replace = conf.delete :replace raise 'Missing required "field" for "gsub" filter' if field.nil? raise 'Missing required "match" for "gsub" filter' if match.nil? raise 'Missing required "replace" for "gsub" filter' if replace.nil? field = field.to_sym log.trace event: 'filter-compiled', kind: 'gsub', \ field: field, match: match, replace: replace lambda do |event| return event unless event.has_key? field event[field].gsub! match, replace filtered event, conf end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
anschel-0.6.5 | lib/anschel/filter/gsub.rb |
anschel-0.6.4 | lib/anschel/filter/gsub.rb |
anschel-0.6.3 | lib/anschel/filter/gsub.rb |
anschel-0.6.2 | lib/anschel/filter/gsub.rb |