How to Write Filter Plugin
require 'fluent/plugin/filter'
module Fluent::Plugin
class PassThruFilter < Filter
# Register this filter as "passthru"
Fluent::Plugin.register_filter('passthru', self)
# config_param works like other plugins
def configure(conf)
super
# Do the usual configuration here
end
# def start
# super
# # Override this method if anything needed as startup.
# end
# def shutdown
# # Override this method to use it to free up resources, etc.
# super
# end
def filter(tag, time, record)
# Since our example is a pass-through filter, it does nothing and just
# returns the record as-is.
# If returns nil, that records are ignored.
record
end
end
endMethods
#filter(tag, time, record)
#filter(tag, time, record)#filter_with_time(tag, time, record)
#filter_with_time(tag, time, record)#filter_stream(tag, es)
#filter_stream(tag, es)Writing Tests
Overview of Tests
Last updated
Was this helpful?