fluentd 0.14.4-x64-mingw32 → 0.14.5-x64-mingw32
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of fluentd might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/ChangeLog +18 -0
- data/example/in_forward.conf +3 -0
- data/example/in_forward_client.conf +37 -0
- data/example/in_forward_shared_key.conf +15 -0
- data/example/in_forward_users.conf +24 -0
- data/example/out_forward.conf +13 -13
- data/example/out_forward_client.conf +109 -0
- data/example/out_forward_shared_key.conf +36 -0
- data/example/out_forward_users.conf +65 -0
- data/example/{out_buffered_null.conf → out_null.conf} +10 -6
- data/example/secondary_file.conf +41 -0
- data/lib/fluent/agent.rb +3 -1
- data/lib/fluent/plugin/buffer.rb +5 -1
- data/lib/fluent/plugin/in_forward.rb +300 -50
- data/lib/fluent/plugin/in_tail.rb +41 -85
- data/lib/fluent/plugin/multi_output.rb +4 -0
- data/lib/fluent/plugin/out_forward.rb +326 -209
- data/lib/fluent/plugin/out_null.rb +37 -0
- data/lib/fluent/plugin/out_secondary_file.rb +128 -0
- data/lib/fluent/plugin/out_stdout.rb +38 -2
- data/lib/fluent/plugin/output.rb +13 -5
- data/lib/fluent/root_agent.rb +1 -1
- data/lib/fluent/test/startup_shutdown.rb +33 -0
- data/lib/fluent/version.rb +1 -1
- data/test/plugin/test_in_forward.rb +906 -441
- data/test/plugin/test_in_monitor_agent.rb +4 -0
- data/test/plugin/test_in_tail.rb +681 -663
- data/test/plugin/test_out_forward.rb +150 -208
- data/test/plugin/test_out_null.rb +85 -9
- data/test/plugin/test_out_secondary_file.rb +432 -0
- data/test/plugin/test_out_stdout.rb +143 -45
- data/test/test_root_agent.rb +42 -0
- metadata +14 -9
- data/lib/fluent/plugin/out_buffered_null.rb +0 -59
- data/lib/fluent/plugin/out_buffered_stdout.rb +0 -70
- data/test/plugin/test_out_buffered_null.rb +0 -79
- data/test/plugin/test_out_buffered_stdout.rb +0 -122
@@ -1,79 +0,0 @@
|
|
1
|
-
require_relative '../helper'
|
2
|
-
require 'fluent/test/driver/output'
|
3
|
-
require 'fluent/plugin/out_buffered_null'
|
4
|
-
|
5
|
-
class BufferedNullOutputTestCase < Test::Unit::TestCase
|
6
|
-
sub_test_case 'BufferedNullOutput' do
|
7
|
-
test 'default chunk limit size is 100' do
|
8
|
-
d = Fluent::Test::Driver::Output.new(Fluent::Plugin::BufferedNullOutput).configure('')
|
9
|
-
assert_equal 10 * 1024, d.instance.buffer_config.chunk_limit_size
|
10
|
-
assert d.instance.buffer_config.flush_at_shutdown
|
11
|
-
assert_equal ['tag'], d.instance.buffer_config.chunk_keys
|
12
|
-
assert d.instance.chunk_key_tag
|
13
|
-
assert !d.instance.chunk_key_time
|
14
|
-
assert_equal [], d.instance.chunk_keys
|
15
|
-
end
|
16
|
-
|
17
|
-
test 'writes standard formattted chunks' do
|
18
|
-
d = Fluent::Test::Driver::Output.new(Fluent::Plugin::BufferedNullOutput).configure('')
|
19
|
-
t = event_time("2016-05-23 00:22:13 -0800")
|
20
|
-
d.run(default_tag: 'test', flush: true) do
|
21
|
-
d.feed(t, {"message" => "null null null"})
|
22
|
-
d.feed(t, {"message" => "null null"})
|
23
|
-
d.feed(t, {"message" => "null"})
|
24
|
-
end
|
25
|
-
|
26
|
-
assert_equal 3, d.instance.emit_count
|
27
|
-
assert_equal 3, d.instance.emit_records
|
28
|
-
end
|
29
|
-
|
30
|
-
test 'check for chunk passed to #write' do
|
31
|
-
d = Fluent::Test::Driver::Output.new(Fluent::Plugin::BufferedNullOutput).configure('')
|
32
|
-
data = []
|
33
|
-
d.instance.feed_proc = ->(chunk){ data << [chunk.unique_id, chunk.metadata.tag, chunk.read] }
|
34
|
-
|
35
|
-
t = event_time("2016-05-23 00:22:13 -0800")
|
36
|
-
d.run(default_tag: 'test', flush: true) do
|
37
|
-
d.feed(t, {"message" => "null null null"})
|
38
|
-
d.feed(t, {"message" => "null null"})
|
39
|
-
d.feed(t, {"message" => "null"})
|
40
|
-
end
|
41
|
-
|
42
|
-
assert_equal 1, data.size
|
43
|
-
_, tag, binary = data.first
|
44
|
-
events = []
|
45
|
-
Fluent::MessagePackFactory.unpacker.feed_each(binary){|obj| events << obj }
|
46
|
-
assert_equal 'test', tag
|
47
|
-
assert_equal [ [t, {"message" => "null null null"}], [t, {"message" => "null null"}], [t, {"message" => "null"}] ], events
|
48
|
-
end
|
49
|
-
|
50
|
-
test 'check for chunk passed to #try_write' do
|
51
|
-
d = Fluent::Test::Driver::Output.new(Fluent::Plugin::BufferedNullOutput).configure('')
|
52
|
-
data = []
|
53
|
-
d.instance.feed_proc = ->(chunk){ data << [chunk.unique_id, chunk.metadata.tag, chunk.read] }
|
54
|
-
d.instance.delayed = true
|
55
|
-
|
56
|
-
t = event_time("2016-05-23 00:22:13 -0800")
|
57
|
-
d.run(default_tag: 'test', flush: true, shutdown: false) do
|
58
|
-
d.feed(t, {"message" => "null null null"})
|
59
|
-
d.feed(t, {"message" => "null null"})
|
60
|
-
d.feed(t, {"message" => "null"})
|
61
|
-
end
|
62
|
-
|
63
|
-
assert_equal 1, data.size
|
64
|
-
chunk_id, tag, binary = data.first
|
65
|
-
events = []
|
66
|
-
Fluent::MessagePackFactory.unpacker.feed_each(binary){|obj| events << obj }
|
67
|
-
assert_equal 'test', tag
|
68
|
-
assert_equal [ [t, {"message" => "null null null"}], [t, {"message" => "null null"}], [t, {"message" => "null"}] ], events
|
69
|
-
|
70
|
-
assert_equal [chunk_id], d.instance.buffer.dequeued.keys
|
71
|
-
|
72
|
-
d.instance.commit_write(chunk_id)
|
73
|
-
|
74
|
-
assert_equal [], d.instance.buffer.dequeued.keys
|
75
|
-
|
76
|
-
d.instance_shutdown
|
77
|
-
end
|
78
|
-
end
|
79
|
-
end
|
@@ -1,122 +0,0 @@
|
|
1
|
-
require_relative '../helper'
|
2
|
-
require 'fluent/test/driver/output'
|
3
|
-
require 'fluent/plugin/out_buffered_stdout'
|
4
|
-
|
5
|
-
class BufferedStdoutOutputTest < Test::Unit::TestCase
|
6
|
-
def setup
|
7
|
-
Fluent::Test.setup
|
8
|
-
end
|
9
|
-
|
10
|
-
CONFIG = %[
|
11
|
-
]
|
12
|
-
|
13
|
-
def create_driver(conf = CONFIG)
|
14
|
-
Fluent::Test::Driver::Output.new(Fluent::Plugin::BufferedStdoutOutput).configure(conf)
|
15
|
-
end
|
16
|
-
|
17
|
-
test 'default configure' do
|
18
|
-
d = create_driver
|
19
|
-
assert_equal [], d.instance.formatter_configs
|
20
|
-
assert_equal 10 * 1024, d.instance.buffer_config.chunk_limit_size
|
21
|
-
assert d.instance.buffer_config.flush_at_shutdown
|
22
|
-
assert_equal ['tag'], d.instance.buffer_config.chunk_keys
|
23
|
-
assert d.instance.chunk_key_tag
|
24
|
-
assert !d.instance.chunk_key_time
|
25
|
-
assert_equal [], d.instance.chunk_keys
|
26
|
-
end
|
27
|
-
|
28
|
-
test 'configure with output_type' do
|
29
|
-
d = create_driver(CONFIG + "\noutput_type json")
|
30
|
-
assert_equal 'json', d.instance.formatter_configs.first[:@type]
|
31
|
-
|
32
|
-
d = create_driver(CONFIG + "\noutput_type hash")
|
33
|
-
assert_equal 'hash', d.instance.formatter_configs.first[:@type]
|
34
|
-
|
35
|
-
assert_raise(Fluent::ConfigError) do
|
36
|
-
d = create_driver(CONFIG + "\noutput_type foo")
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
sub_test_case "emit with default config" do
|
41
|
-
test '#write(synchronous)' do
|
42
|
-
d = create_driver
|
43
|
-
time = event_time()
|
44
|
-
|
45
|
-
out = capture_log do
|
46
|
-
d.run(default_tag: 'test', flush: true) do
|
47
|
-
d.feed(time, {'test' => 'test'})
|
48
|
-
end
|
49
|
-
end
|
50
|
-
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test\"}\n", out
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
sub_test_case "emit json" do
|
55
|
-
data('oj' => 'oj', 'yajl' => 'yajl')
|
56
|
-
test '#write(synchronous)' do |data|
|
57
|
-
d = create_driver(CONFIG + "\noutput_type json\njson_parser #{data}")
|
58
|
-
time = event_time()
|
59
|
-
|
60
|
-
out = capture_log do
|
61
|
-
d.run(default_tag: 'test', flush: true) do
|
62
|
-
d.feed(time, {'test' => 'test'})
|
63
|
-
end
|
64
|
-
end
|
65
|
-
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test\"}\n", out
|
66
|
-
end
|
67
|
-
|
68
|
-
data('oj' => 'oj', 'yajl' => 'yajl')
|
69
|
-
test '#try_write(asynchronous)' do |data|
|
70
|
-
d = create_driver(CONFIG + "\noutput_type json\njson_parser #{data}")
|
71
|
-
time = event_time()
|
72
|
-
d.instance.delayed = true
|
73
|
-
|
74
|
-
out = capture_log do
|
75
|
-
d.run(default_tag: 'test', flush: true, shutdown: false) do
|
76
|
-
d.feed(time, {'test' => 'test'})
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test\"}\n", out
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
sub_test_case 'emit hash' do
|
85
|
-
test '#write(synchronous)' do
|
86
|
-
d = create_driver(CONFIG + "\noutput_type hash")
|
87
|
-
time = event_time()
|
88
|
-
|
89
|
-
out = capture_log do
|
90
|
-
d.run(default_tag: 'test', flush: true) do
|
91
|
-
d.feed(time, {'test' => 'test'})
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
assert_equal "#{Time.at(time).localtime} test: {\"test\"=>\"test\"}\n", out
|
96
|
-
end
|
97
|
-
|
98
|
-
test '#try_write(asynchronous)' do
|
99
|
-
d = create_driver(CONFIG + "\noutput_type hash")
|
100
|
-
time = event_time()
|
101
|
-
d.instance.delayed = true
|
102
|
-
|
103
|
-
out = capture_log do
|
104
|
-
d.run(default_tag: 'test', flush: true, shutdown: false) do
|
105
|
-
d.feed(time, {'test' => 'test'})
|
106
|
-
end
|
107
|
-
end
|
108
|
-
|
109
|
-
assert_equal "#{Time.at(time).localtime} test: {\"test\"=>\"test\"}\n", out
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
# Capture the log output of the block given
|
114
|
-
def capture_log(&block)
|
115
|
-
tmp = $log
|
116
|
-
$log = StringIO.new
|
117
|
-
yield
|
118
|
-
return $log.string
|
119
|
-
ensure
|
120
|
-
$log = tmp
|
121
|
-
end
|
122
|
-
end
|