Skip to content

Commit

Permalink
rewrite filter_grep using new filter plugin API
Browse files Browse the repository at this point in the history
  • Loading branch information
sonots committed Dec 16, 2014
1 parent 4b9a473 commit 5f58d9c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/fluent/plugin/filter_grep.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,23 +49,23 @@ def configure(conf)
end
end

def filter_stream(tag, es)
result_es = MultiEventStream.new
es.each do |time, record|
def filter(tag, time, record)
result = nil
begin
catch(:break_loop) do
@regexps.each do |key, regexp|
throw :break_loop unless match(regexp, record[key].to_s)
end
@excludes.each do |key, exclude|
throw :break_loop if match(exclude, record[key].to_s)
end
result_es.add(time, record)
result = record
end
rescue => e
log.warn "failed to grep events", :error_class => e.class, :error => e.message
log.warn_backtrace
end
result_es
rescue => e
log.warn "failed to grep events", :error_class => e.class, :error => e.message
log.warn_backtrace
result
end

private
Expand Down

0 comments on commit 5f58d9c

Please sign in to comment.