Plugin Helper: Parser
require 'fluent/plugin/input'
module Fluent::Plugin
class ExampleInput < Input
Fluent::Plugin.register_input('example', self)
# 1. Load parser helper
helpers :parser
# Omit `shutdown` and other plugin APIs
def configure(conf)
super
# 2. Create parser plugin instance
@parser = parser_create
end
def start
super
# Use parser helper in combination usually with other plugin helpers
timer_execute(:example_timer, 10) do
read_raw_data do |text|
# 3. Call `@parser.parse(text)` to parse raw data
@parser.parse(text) do |time, record|
router.emit(tag, time, record)
end
end
end
end
end
endMethods
parser_create(usage: "", type: nil, conf: nil, default_type: nil)
parser_create(usage: "", type: nil, conf: nil, default_type: nil)Plugins using parser
parserLast updated
Was this helpful?