class Fluent::Plugin::DirectoryInput
Public Instance Methods
start() { |nil, nil| ... }
click to toggle source
Calls superclass method
# File lib/fluent/plugin/in_directory.rb, line 40 def start super # See: https://docs.fluentd.org/plugin-helper-overview/api-plugin-helper-timer timer_execute(:directory_timer, @run_interval) do begin # Use a stream to submit multiple events at the same time multiEventStream = MultiEventStream.new # Use the current time as the event time time = Fluent::Engine.now # Read filenames in the directory Dir.glob(@path + '/*') do |filename| # Add the record to the stream multiEventStream.add( time, { @content_key => File.read(filename), @filename_key => filename }, ) # Remove the file File.delete(filename) end # Send the events router.emit_stream(tag, multiEventStream) rescue StandardError yield(nil, nil) end end end