fluentd 0.12.20 → 0.12.21
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 +23 -0
- data/Rakefile +2 -2
- data/bin/fluent-debug +0 -1
- data/lib/fluent/agent.rb +12 -9
- data/lib/fluent/buffer.rb +9 -3
- data/lib/fluent/command/bundler_injection.rb +2 -0
- data/lib/fluent/command/cat.rb +1 -1
- data/lib/fluent/command/debug.rb +3 -2
- data/lib/fluent/command/fluentd.rb +3 -1
- data/lib/fluent/config.rb +4 -5
- data/lib/fluent/config/basic_parser.rb +3 -4
- data/lib/fluent/config/configure_proxy.rb +2 -0
- data/lib/fluent/config/dsl.rb +3 -0
- data/lib/fluent/config/element.rb +3 -2
- data/lib/fluent/config/literal_parser.rb +8 -5
- data/lib/fluent/config/parser.rb +5 -3
- data/lib/fluent/config/section.rb +3 -3
- data/lib/fluent/config/types.rb +44 -50
- data/lib/fluent/config/v1_parser.rb +8 -6
- data/lib/fluent/configurable.rb +8 -6
- data/lib/fluent/engine.rb +23 -11
- data/lib/fluent/event.rb +2 -0
- data/lib/fluent/event_router.rb +4 -2
- data/lib/fluent/filter.rb +6 -0
- data/lib/fluent/formatter.rb +27 -25
- data/lib/fluent/input.rb +5 -0
- data/lib/fluent/label.rb +2 -2
- data/lib/fluent/log.rb +5 -2
- data/lib/fluent/mixin.rb +4 -2
- data/lib/fluent/output.rb +45 -31
- data/lib/fluent/parser.rb +35 -25
- data/lib/fluent/plugin.rb +4 -0
- data/lib/fluent/plugin/buf_file.rb +9 -2
- data/lib/fluent/plugin/buf_memory.rb +7 -1
- data/lib/fluent/plugin/exec_util.rb +7 -2
- data/lib/fluent/plugin/filter_grep.rb +6 -3
- data/lib/fluent/plugin/filter_record_transformer.rb +52 -51
- data/lib/fluent/plugin/filter_stdout.rb +4 -1
- data/lib/fluent/plugin/in_debug_agent.rb +7 -5
- data/lib/fluent/plugin/in_dummy.rb +8 -3
- data/lib/fluent/plugin/in_exec.rb +16 -10
- data/lib/fluent/plugin/in_forward.rb +18 -11
- data/lib/fluent/plugin/in_gc_stat.rb +6 -2
- data/lib/fluent/plugin/in_http.rb +23 -14
- data/lib/fluent/plugin/in_monitor_agent.rb +24 -17
- data/lib/fluent/plugin/in_object_space.rb +9 -4
- data/lib/fluent/plugin/in_stream.rb +15 -6
- data/lib/fluent/plugin/in_syslog.rb +18 -12
- data/lib/fluent/plugin/in_tail.rb +61 -40
- data/lib/fluent/plugin/in_tcp.rb +3 -1
- data/lib/fluent/plugin/in_udp.rb +1 -1
- data/lib/fluent/plugin/out_copy.rb +5 -1
- data/lib/fluent/plugin/out_exec.rb +9 -6
- data/lib/fluent/plugin/out_exec_filter.rb +32 -25
- data/lib/fluent/plugin/out_file.rb +11 -5
- data/lib/fluent/plugin/out_forward.rb +30 -24
- data/lib/fluent/plugin/out_null.rb +2 -0
- data/lib/fluent/plugin/out_relabel.rb +2 -0
- data/lib/fluent/plugin/out_roundrobin.rb +3 -0
- data/lib/fluent/plugin/out_stdout.rb +3 -1
- data/lib/fluent/plugin/out_stream.rb +8 -8
- data/lib/fluent/plugin/socket_util.rb +12 -10
- data/lib/fluent/process.rb +14 -8
- data/lib/fluent/registry.rb +2 -2
- data/lib/fluent/root_agent.rb +16 -12
- data/lib/fluent/rpc.rb +7 -7
- data/lib/fluent/supervisor.rb +35 -69
- data/lib/fluent/system_config.rb +98 -0
- data/lib/fluent/test.rb +1 -1
- data/lib/fluent/test/base.rb +6 -1
- data/lib/fluent/test/filter_test.rb +4 -0
- data/lib/fluent/test/formatter_test.rb +3 -2
- data/lib/fluent/test/input_test.rb +6 -0
- data/lib/fluent/test/output_test.rb +4 -0
- data/lib/fluent/test/parser_test.rb +3 -2
- data/lib/fluent/timezone.rb +2 -0
- data/lib/fluent/version.rb +1 -1
- data/test/config/test_configurable.rb +11 -11
- data/test/config/test_configure_proxy.rb +1 -1
- data/test/config/test_system_config.rb +5 -5
- data/test/config/test_types.rb +70 -0
- data/test/plugin/test_filter_record_transformer.rb +72 -55
- data/test/plugin/test_in_forward.rb +4 -0
- data/test/plugin/test_in_tail.rb +73 -2
- data/test/test_config.rb +2 -2
- data/test/test_event_router.rb +1 -0
- data/test/test_output.rb +27 -3
- data/test/test_plugin_classes.rb +3 -0
- data/test/test_process.rb +1 -0
- data/test/test_root_agent.rb +5 -3
- metadata +3 -2
data/test/plugin/test_in_tail.rb
CHANGED
@@ -30,6 +30,9 @@ class TailInputTest < Test::Unit::TestCase
|
|
30
30
|
CONFIG_READ_FROM_HEAD = %[
|
31
31
|
read_from_head true
|
32
32
|
]
|
33
|
+
CONFIG_ENABLE_WATCH_TIMER = %[
|
34
|
+
enable_watch_timer false
|
35
|
+
]
|
33
36
|
SINGLE_LINE_CONFIG = %[
|
34
37
|
format /(?<message>.*)/
|
35
38
|
]
|
@@ -124,6 +127,32 @@ class TailInputTest < Test::Unit::TestCase
|
|
124
127
|
assert_equal({"message" => "test4"}, emits[3][2])
|
125
128
|
end
|
126
129
|
|
130
|
+
def test_emit_with_enable_watch_timer
|
131
|
+
File.open("#{TMP_DIR}/tail.txt", "wb") {|f|
|
132
|
+
f.puts "test1"
|
133
|
+
f.puts "test2"
|
134
|
+
}
|
135
|
+
|
136
|
+
d = create_driver(CONFIG_ENABLE_WATCH_TIMER + SINGLE_LINE_CONFIG)
|
137
|
+
|
138
|
+
d.run do
|
139
|
+
sleep 1
|
140
|
+
|
141
|
+
File.open("#{TMP_DIR}/tail.txt", "ab") {|f|
|
142
|
+
f.puts "test3"
|
143
|
+
f.puts "test4"
|
144
|
+
}
|
145
|
+
# according to cool.io's stat_watcher.c, systems without inotify will use
|
146
|
+
# an "automatic" value, typically around 5 seconds
|
147
|
+
sleep 10
|
148
|
+
end
|
149
|
+
|
150
|
+
emits = d.emits
|
151
|
+
assert(emits.length > 0)
|
152
|
+
assert_equal({"message" => "test3"}, emits[0][2])
|
153
|
+
assert_equal({"message" => "test4"}, emits[1][2])
|
154
|
+
end
|
155
|
+
|
127
156
|
def test_rotate_file
|
128
157
|
emits = sub_test_rotate_file(SINGLE_LINE_CONFIG)
|
129
158
|
assert_equal(4, emits.length)
|
@@ -484,7 +513,7 @@ class TailInputTest < Test::Unit::TestCase
|
|
484
513
|
|
485
514
|
flexstub(Fluent::NewTailInput::TailWatcher) do |watcherclass|
|
486
515
|
EX_PATHS.each do |path|
|
487
|
-
watcherclass.should_receive(:new).with(path, EX_RORATE_WAIT, Fluent::NewTailInput::FilePositionEntry, any, true, 1000, any, any, any).once.and_return do
|
516
|
+
watcherclass.should_receive(:new).with(path, EX_RORATE_WAIT, Fluent::NewTailInput::FilePositionEntry, any, true, true, 1000, any, any, any).once.and_return do
|
488
517
|
flexmock('TailWatcher') { |watcher|
|
489
518
|
watcher.should_receive(:attach).once
|
490
519
|
watcher.should_receive(:unwatched=).zero_or_more_times
|
@@ -500,7 +529,7 @@ class TailInputTest < Test::Unit::TestCase
|
|
500
529
|
end
|
501
530
|
|
502
531
|
flexstub(Fluent::NewTailInput::TailWatcher) do |watcherclass|
|
503
|
-
watcherclass.should_receive(:new).with('test/plugin/data/2010/01/20100102-030406.log', EX_RORATE_WAIT, Fluent::NewTailInput::FilePositionEntry, any, true, 1000, any, any, any).once.and_return do
|
532
|
+
watcherclass.should_receive(:new).with('test/plugin/data/2010/01/20100102-030406.log', EX_RORATE_WAIT, Fluent::NewTailInput::FilePositionEntry, any, true, true, 1000, any, any, any).once.and_return do
|
504
533
|
flexmock('TailWatcher') do |watcher|
|
505
534
|
watcher.should_receive(:attach).once
|
506
535
|
watcher.should_receive(:unwatched=).zero_or_more_times
|
@@ -609,4 +638,46 @@ class TailInputTest < Test::Unit::TestCase
|
|
609
638
|
assert_equal({"message" => "test4"}, emits[1][2])
|
610
639
|
end
|
611
640
|
end
|
641
|
+
|
642
|
+
sub_test_case 'emit error cases' do
|
643
|
+
def test_emit_error_with_buffer_queue_limit_error
|
644
|
+
emits = execute_test(::Fluent::BufferQueueLimitError, "queue size exceeds limit")
|
645
|
+
assert_equal(10, emits.length)
|
646
|
+
10.times { |i|
|
647
|
+
assert_equal({"message" => "test#{i}"}, emits[i][2])
|
648
|
+
}
|
649
|
+
end
|
650
|
+
|
651
|
+
def test_emit_error_with_non_buffer_queue_limit_error
|
652
|
+
emits = execute_test(StandardError, "non BufferQueueLimitError error")
|
653
|
+
assert_true(emits.size > 0 && emits.size != 10)
|
654
|
+
emits.size.times { |i|
|
655
|
+
assert_equal({"message" => "test#{10 - emits.size + i}"}, emits[i][2])
|
656
|
+
}
|
657
|
+
end
|
658
|
+
|
659
|
+
def execute_test(error_class, error_message)
|
660
|
+
d = create_driver(CONFIG_READ_FROM_HEAD + SINGLE_LINE_CONFIG)
|
661
|
+
# Use define_singleton_method instead of d.emit_stream to capture local variable
|
662
|
+
d.define_singleton_method(:emit_stream) do |tag, es|
|
663
|
+
@test_num_errors ||= 0
|
664
|
+
if @test_num_errors < 5
|
665
|
+
@test_num_errors += 1
|
666
|
+
raise error_class, error_message
|
667
|
+
else
|
668
|
+
@emit_streams << [tag, es.to_a]
|
669
|
+
end
|
670
|
+
end
|
671
|
+
|
672
|
+
d.run do
|
673
|
+
10.times { |i|
|
674
|
+
File.open("#{TMP_DIR}/tail.txt", "ab") { |f| f.puts "test#{i}" }
|
675
|
+
sleep 0.5
|
676
|
+
}
|
677
|
+
sleep 1
|
678
|
+
end
|
679
|
+
|
680
|
+
d.emits
|
681
|
+
end
|
682
|
+
end
|
612
683
|
end
|
data/test/test_config.rb
CHANGED
@@ -159,8 +159,8 @@ class ConfigTest < Test::Unit::TestCase
|
|
159
159
|
def test_inline
|
160
160
|
prepare_config
|
161
161
|
opts = {
|
162
|
-
:
|
163
|
-
:
|
162
|
+
config_path: "#{TMP_DIR}/config_test_1.conf",
|
163
|
+
inline_config: "<source>\n type http\n port 2222\n </source>"
|
164
164
|
}
|
165
165
|
assert_nothing_raised do
|
166
166
|
Fluent::Supervisor.new(opts)
|
data/test/test_event_router.rb
CHANGED
data/test/test_output.rb
CHANGED
@@ -215,13 +215,13 @@ module FluentOutputTest
|
|
215
215
|
|
216
216
|
TMP_DIR = File.expand_path(File.dirname(__FILE__) + "/tmp/time_sliced_output")
|
217
217
|
|
218
|
-
CONFIG = %[]
|
218
|
+
CONFIG = %[buffer_path #{TMP_DIR}/foo]
|
219
219
|
|
220
220
|
def create_driver(conf=CONFIG)
|
221
221
|
Fluent::Test::TimeSlicedOutputTestDriver.new(Fluent::TimeSlicedOutput).configure(conf, true)
|
222
222
|
end
|
223
223
|
|
224
|
-
sub_test_case "
|
224
|
+
sub_test_case "force_flush test" do
|
225
225
|
setup do
|
226
226
|
time = Time.parse("2011-01-02 13:14:15 UTC")
|
227
227
|
Timecop.freeze(time)
|
@@ -235,7 +235,6 @@ module FluentOutputTest
|
|
235
235
|
test "force_flush immediately flushes" do
|
236
236
|
d = create_driver(CONFIG + %[
|
237
237
|
time_format %Y%m%d%H%M%S
|
238
|
-
buffer_path #{TMP_DIR}/foo
|
239
238
|
])
|
240
239
|
d.instance.start
|
241
240
|
# buffer should be popped (flushed) immediately
|
@@ -246,5 +245,30 @@ module FluentOutputTest
|
|
246
245
|
10.times { sleep 0.05 }
|
247
246
|
end
|
248
247
|
end
|
248
|
+
|
249
|
+
sub_test_case "test emit" do
|
250
|
+
setup do
|
251
|
+
@time = Time.parse("2011-01-02 13:14:15 UTC")
|
252
|
+
Timecop.freeze(@time)
|
253
|
+
end
|
254
|
+
|
255
|
+
teardown do
|
256
|
+
Timecop.return
|
257
|
+
end
|
258
|
+
|
259
|
+
test "emit with valid event" do
|
260
|
+
d = create_driver
|
261
|
+
d.instance.start
|
262
|
+
d.instance.emit('test', OneEventStream.new(@time.to_i, {"message" => "foo"}), NullOutputChain.instance)
|
263
|
+
assert_equal 0, d.instance.log.logs.size
|
264
|
+
end
|
265
|
+
|
266
|
+
test "emit with invalid event" do
|
267
|
+
d = create_driver
|
268
|
+
d.instance.start
|
269
|
+
d.instance.emit('test', OneEventStream.new('string', 10), NullOutputChain.instance)
|
270
|
+
assert_equal 1, d.instance.log.logs.count { |line| line =~ /dump an error event/ }
|
271
|
+
end
|
272
|
+
end
|
249
273
|
end
|
250
274
|
end
|
data/test/test_plugin_classes.rb
CHANGED
data/test/test_process.rb
CHANGED
data/test/test_root_agent.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
require_relative 'helper'
|
1
2
|
require 'fluent/event_router'
|
3
|
+
require 'fluent/system_config'
|
2
4
|
require_relative 'test_plugin_classes'
|
3
5
|
|
4
6
|
class RootAgentTest < ::Test::Unit::TestCase
|
@@ -12,12 +14,12 @@ class RootAgentTest < ::Test::Unit::TestCase
|
|
12
14
|
end
|
13
15
|
|
14
16
|
data(
|
15
|
-
'suppress interval' => [{
|
16
|
-
'without source' => [{
|
17
|
+
'suppress interval' => [{'emit_error_log_interval' => 30}, {:@suppress_emit_error_log_interval => 30}],
|
18
|
+
'without source' => [{'without_source' => true}, {:@without_source => true}]
|
17
19
|
)
|
18
20
|
def test_initialize_with_opt(data)
|
19
21
|
opt, expected = data
|
20
|
-
ra = RootAgent.new(opt)
|
22
|
+
ra = RootAgent.new(SystemConfig.new(opt))
|
21
23
|
expected.each { |k, v|
|
22
24
|
assert_equal v, ra.instance_variable_get(k)
|
23
25
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluentd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.12.
|
4
|
+
version: 0.12.21
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -391,6 +391,7 @@ files:
|
|
391
391
|
- lib/fluent/rpc.rb
|
392
392
|
- lib/fluent/status.rb
|
393
393
|
- lib/fluent/supervisor.rb
|
394
|
+
- lib/fluent/system_config.rb
|
394
395
|
- lib/fluent/test.rb
|
395
396
|
- lib/fluent/test/base.rb
|
396
397
|
- lib/fluent/test/filter_test.rb
|