Class: Fluent::NoMatchMatch

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/match.rb

Instance Method Summary collapse

Constructor Details

#initialize(log) ⇒ NoMatchMatch

Returns a new instance of NoMatchMatch.



152
153
154
155
156
# File 'lib/fluent/match.rb', line 152

def initialize(log)
  @log = log
  @count = 0
  @warn_not_matched = true
end

Instance Method Details

#emit_events(tag, es) ⇒ Object



163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/fluent/match.rb', line 163

def emit_events(tag, es)
  return unless @warn_not_matched
  # TODO use time instead of num of records
  c = (@count += 1)
  if c < 512
    if Math.log(c) / Math.log(2) % 1.0 == 0
      @log.warn "no patterns matched", tag: tag
      return
    end
  else
    if c % 512 == 0
      @log.warn "no patterns matched", tag: tag
      return
    end
  end
  @log.on_trace { @log.trace "no patterns matched", tag: tag }
end

#shutdownObject



184
185
# File 'lib/fluent/match.rb', line 184

def shutdown
end

#startObject



181
182
# File 'lib/fluent/match.rb', line 181

def start
end

#suppress_missing_match!Object



158
159
160
161
# File 'lib/fluent/match.rb', line 158

def suppress_missing_match!
  # for <label @FLUENT_LOG>
  @warn_not_matched = false
end