43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
# File 'lib/fluent/plugin/in_directory.rb', line 43
def start
super
timer_execute(:directory_timer, @run_interval) do
begin
multiEventStream = MultiEventStream.new
time = Fluent::Engine.now
Dir
.glob(@path + '/*')
.take(@batch_size)
.each do |filename|
multiEventStream.add(
time,
{
@content_key => File.read(filename),
@filename_key => filename
}
)
File.delete(filename)
end
router.emit_stream(tag, multiEventStream)
rescue StandardError
yield(nil, nil)
end
end
end
|