Class: LogStash::Filters::Grok::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/filters/grok.rb

Overview

Internal (base) helper to handle the global timeout switch.

Direct Known Subclasses

EventTimeoutMatcher, PatternTimeoutMatcher

Instance Method Summary collapse

Constructor Details

#initialize(filter) ⇒ Matcher

Returns a new instance of Matcher.



374
375
376
# File 'lib/logstash/filters/grok.rb', line 374

def initialize(filter)
  @filter = filter
end

Instance Method Details

#match(context, groks, event, break_on_match) ⇒ Object



378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
# File 'lib/logstash/filters/grok.rb', line 378

def match(context, groks, event, break_on_match)
  matched = false

  groks.each do |grok|
    context.set_grok(grok)

    matched = execute(context, grok)
    if matched
      grok.capture(matched) { |field, value| @filter.handle(field, value, event) }
      break if break_on_match
    end
  end

  matched
end