Class: Fluent::Plugin::NaisKeywordsFilter

Inherits:
Filter
  • Object
show all
Defined in:
lib/fluent/plugin/filter_nais_keywords.rb

Instance Method Summary collapse

Instance Method Details

#configure(conf) ⇒ Object



11
12
13
14
# File 'lib/fluent/plugin/filter_nais_keywords.rb', line 11

def configure(conf)
  super
  @re = Regexp.new(@regex)
end

#filter(tag, time, record) ⇒ Object



16
17
18
19
20
# File 'lib/fluent/plugin/filter_nais_keywords.rb', line 16

def filter(tag, time, record)
  keywords = ::Nais::Log::Parser.get_keywords(record['message'].to_s+' '+record['stack_trace'].to_s, @re)
  record[@field] = keywords unless keywords.nil?
  record
end