fluentd 0.12.0.pre.1 → 0.12.0.pre.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of fluentd might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/.gitignore +1 -1
- data/.travis.yml +1 -0
- data/ChangeLog +21 -0
- data/README.md +10 -2
- data/Rakefile +4 -13
- data/example/v1_literal_example.conf +36 -0
- data/fluentd.gemspec +4 -1
- data/lib/fluent/buffer.rb +73 -46
- data/lib/fluent/command/fluentd.rb +7 -2
- data/lib/fluent/config/basic_parser.rb +5 -0
- data/lib/fluent/config/element.rb +2 -5
- data/lib/fluent/config/literal_parser.rb +26 -7
- data/lib/fluent/config/section.rb +2 -0
- data/lib/fluent/config/v1_parser.rb +9 -2
- data/lib/fluent/formatter.rb +2 -1
- data/lib/fluent/mixin.rb +22 -7
- data/lib/fluent/output.rb +17 -8
- data/lib/fluent/parser.rb +14 -3
- data/lib/fluent/plugin/buf_file.rb +30 -15
- data/lib/fluent/plugin/filter_grep.rb +69 -0
- data/lib/fluent/plugin/filter_record_transformer.rb +183 -0
- data/lib/fluent/plugin/in_exec.rb +6 -0
- data/lib/fluent/plugin/in_forward.rb +34 -4
- data/lib/fluent/plugin/in_http.rb +1 -1
- data/lib/fluent/plugin/out_exec.rb +1 -1
- data/lib/fluent/plugin/out_exec_filter.rb +8 -1
- data/lib/fluent/plugin/out_forward.rb +82 -4
- data/lib/fluent/supervisor.rb +1 -1
- data/lib/fluent/timezone.rb +131 -0
- data/lib/fluent/version.rb +1 -1
- data/test/config/assertions.rb +42 -0
- data/test/config/test_config_parser.rb +385 -0
- data/test/config/test_configurable.rb +530 -0
- data/test/config/test_configure_proxy.rb +99 -0
- data/test/config/test_dsl.rb +237 -0
- data/test/config/test_literal_parser.rb +293 -0
- data/test/config/test_section.rb +112 -0
- data/test/config/test_system_config.rb +49 -0
- data/test/helper.rb +25 -0
- data/test/plugin/test_buf_file.rb +604 -0
- data/test/plugin/test_buf_memory.rb +204 -0
- data/test/plugin/test_filter_grep.rb +124 -0
- data/test/plugin/test_filter_record_transformer.rb +251 -0
- data/test/plugin/test_in_exec.rb +1 -0
- data/test/plugin/test_in_forward.rb +205 -2
- data/test/plugin/test_in_gc_stat.rb +1 -0
- data/test/plugin/test_in_http.rb +58 -2
- data/test/plugin/test_in_object_space.rb +1 -0
- data/test/plugin/test_in_status.rb +1 -0
- data/test/plugin/test_in_stream.rb +1 -1
- data/test/plugin/test_in_syslog.rb +1 -1
- data/test/plugin/test_in_tail.rb +1 -0
- data/test/plugin/test_in_tcp.rb +1 -1
- data/test/plugin/test_in_udp.rb +1 -1
- data/test/plugin/test_out_copy.rb +1 -0
- data/test/plugin/test_out_exec.rb +1 -0
- data/test/plugin/test_out_exec_filter.rb +1 -0
- data/test/plugin/test_out_file.rb +36 -0
- data/test/plugin/test_out_forward.rb +279 -8
- data/test/plugin/test_out_roundrobin.rb +1 -0
- data/test/plugin/test_out_stdout.rb +1 -0
- data/test/plugin/test_out_stream.rb +1 -1
- data/test/test_buffer.rb +530 -0
- data/test/test_config.rb +1 -1
- data/test/test_configdsl.rb +1 -1
- data/test/test_formatter.rb +223 -0
- data/test/test_match.rb +1 -2
- data/test/test_mixin.rb +74 -2
- data/test/test_parser.rb +7 -1
- metadata +88 -35
- data/lib/fluent/plugin/buf_zfile.rb +0 -75
- data/spec/config/config_parser_spec.rb +0 -314
- data/spec/config/configurable_spec.rb +0 -524
- data/spec/config/configure_proxy_spec.rb +0 -96
- data/spec/config/dsl_spec.rb +0 -239
- data/spec/config/helper.rb +0 -49
- data/spec/config/literal_parser_spec.rb +0 -222
- data/spec/config/section_spec.rb +0 -97
- data/spec/config/system_config_spec.rb +0 -49
- data/spec/spec_helper.rb +0 -60
data/spec/config/section_spec.rb
DELETED
@@ -1,97 +0,0 @@
|
|
1
|
-
require 'fluent/config/section'
|
2
|
-
|
3
|
-
describe Fluent::Config::Section do
|
4
|
-
context 'class' do
|
5
|
-
describe '.name' do
|
6
|
-
it 'returns its full module name as String' do
|
7
|
-
expect(Fluent::Config::Section.name).to eql('Fluent::Config::Section')
|
8
|
-
end
|
9
|
-
end
|
10
|
-
end
|
11
|
-
|
12
|
-
context 'instance object' do
|
13
|
-
describe '#initialize' do
|
14
|
-
it 'creates blank object without argument' do
|
15
|
-
s = Fluent::Config::Section.new
|
16
|
-
expect(s.instance_eval{ @params }).to eql({})
|
17
|
-
end
|
18
|
-
|
19
|
-
it 'creates object which contains specified hash object itself' do
|
20
|
-
hash = {
|
21
|
-
name: 'tagomoris',
|
22
|
-
age: 34,
|
23
|
-
send: 'email',
|
24
|
-
class: 'normal',
|
25
|
-
keys: 5,
|
26
|
-
}
|
27
|
-
s1 = Fluent::Config::Section.new(hash)
|
28
|
-
expect(s1.instance_eval{ @params }).to eq(hash)
|
29
|
-
expect(s1[:name]).to eql("tagomoris")
|
30
|
-
expect(s1[:age]).to eql(34)
|
31
|
-
expect(s1[:send]).to eql("email")
|
32
|
-
expect(s1[:class]).to eql("normal")
|
33
|
-
expect(s1[:keys]).to eql(5)
|
34
|
-
|
35
|
-
expect(s1.name).to eql("tagomoris")
|
36
|
-
expect(s1.age).to eql(34)
|
37
|
-
expect(s1.send).to eql("email")
|
38
|
-
expect(s1.class).to eql("normal")
|
39
|
-
expect(s1.keys).to eql(5)
|
40
|
-
|
41
|
-
expect{ s1.dup }.to raise_error(NoMethodError)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
|
45
|
-
describe '#to_h' do
|
46
|
-
it 'returns internal hash itself' do
|
47
|
-
hash = {
|
48
|
-
name: 'tagomoris',
|
49
|
-
age: 34,
|
50
|
-
send: 'email',
|
51
|
-
class: 'normal',
|
52
|
-
keys: 5,
|
53
|
-
}
|
54
|
-
s = Fluent::Config::Section.new(hash)
|
55
|
-
expect(s.to_h).to eq(hash)
|
56
|
-
expect(s.to_h.class).to eq(Hash)
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe '#instance_of?' do
|
61
|
-
it 'can judge whether it is a Section object or not' do
|
62
|
-
s = Fluent::Config::Section.new
|
63
|
-
expect(s.instance_of?(Fluent::Config::Section)).to be true
|
64
|
-
expect(s.instance_of?(BasicObject)).to be false
|
65
|
-
end
|
66
|
-
end
|
67
|
-
|
68
|
-
describe '#is_a?' do
|
69
|
-
it 'can judge whether it belongs to or not' do
|
70
|
-
s = Fluent::Config::Section.new
|
71
|
-
expect(s.is_a?(Fluent::Config::Section)).to be true
|
72
|
-
expect(s.kind_of?(Fluent::Config::Section)).to be true
|
73
|
-
expect(s.is_a?(BasicObject)).to be true
|
74
|
-
end
|
75
|
-
end
|
76
|
-
|
77
|
-
describe '#+' do
|
78
|
-
it 'can merge 2 sections: argument side is primary, internal hash is newly created' do
|
79
|
-
h1 = {name: "s1", num: 10, class: "A"}
|
80
|
-
s1 = Fluent::Config::Section.new(h1)
|
81
|
-
|
82
|
-
h2 = {name: "s2", class: "A", num2: "5", num3: "8"}
|
83
|
-
s2 = Fluent::Config::Section.new(h2)
|
84
|
-
s = s1 + s2
|
85
|
-
|
86
|
-
expect(s.to_h.object_id).not_to eq(h1.object_id)
|
87
|
-
expect(s.to_h.object_id).not_to eq(h2.object_id)
|
88
|
-
|
89
|
-
expect(s.name).to eql("s2")
|
90
|
-
expect(s.num).to eql(10)
|
91
|
-
expect(s.class).to eql("A")
|
92
|
-
expect(s.num2).to eql("5")
|
93
|
-
expect(s.num3).to eql("8")
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'fluent/configurable'
|
2
|
-
require 'fluent/config/element'
|
3
|
-
require 'fluent/config/section'
|
4
|
-
require 'fluent/supervisor'
|
5
|
-
|
6
|
-
describe Fluent::Supervisor::SystemConfig do
|
7
|
-
def parse_text(text)
|
8
|
-
basepath = File.expand_path(File.dirname(__FILE__) + '/../../')
|
9
|
-
Fluent::Config.parse(text, '(test)', basepath, true).elements.find { |e| e.name == 'system' }
|
10
|
-
end
|
11
|
-
|
12
|
-
it 'should not override default configurations when no parameters' do
|
13
|
-
conf = parse_text(<<EOS)
|
14
|
-
<system>
|
15
|
-
</system>
|
16
|
-
EOS
|
17
|
-
sc = Fluent::Supervisor::SystemConfig.new(conf)
|
18
|
-
expect(sc.log_level).to be_nil
|
19
|
-
expect(sc.suppress_repeated_stacktrace).to be_nil
|
20
|
-
expect(sc.emit_error_log_interval).to be_nil
|
21
|
-
expect(sc.suppress_config_dump).to be_nil
|
22
|
-
expect(sc.without_source).to be_nil
|
23
|
-
expect(sc.to_opt).to eql({})
|
24
|
-
end
|
25
|
-
|
26
|
-
{'log_level' => 'error', 'suppress_repeated_stacktrace' => true, 'emit_error_log_interval' => 60, 'suppress_config_dump' => true, 'without_source' => true}.each { |k, v|
|
27
|
-
it "accepts #{k} parameter" do
|
28
|
-
conf = parse_text(<<EOS)
|
29
|
-
<system>
|
30
|
-
#{k} #{v}
|
31
|
-
</system>
|
32
|
-
EOS
|
33
|
-
sc = Fluent::Supervisor::SystemConfig.new(conf)
|
34
|
-
expect(sc.instance_variable_get("@#{k}")).not_to be_nil
|
35
|
-
if k == 'emit_error_log_interval'
|
36
|
-
expect(sc.to_opt).to include(:suppress_interval)
|
37
|
-
else
|
38
|
-
expect(sc.to_opt).to include(k.to_sym)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
}
|
42
|
-
|
43
|
-
{'foo' => 'bar', 'hoge' => 'fuga'}.each { |k, v|
|
44
|
-
it "should not affect settable parameters with unknown #{k} parameter" do
|
45
|
-
sc = Fluent::Supervisor::SystemConfig.new({k => v})
|
46
|
-
expect(sc.to_opt).to be_empty
|
47
|
-
end
|
48
|
-
}
|
49
|
-
end
|
data/spec/spec_helper.rb
DELETED
@@ -1,60 +0,0 @@
|
|
1
|
-
|
2
|
-
require 'fluent/load'
|
3
|
-
require 'fileutils'
|
4
|
-
|
5
|
-
src_root = File.expand_path('..', File.dirname(__FILE__))
|
6
|
-
$LOAD_PATH << File.join(src_root, "lib")
|
7
|
-
$LOAD_PATH << src_root
|
8
|
-
|
9
|
-
if ENV['SIMPLE_COV']
|
10
|
-
require 'simplecov'
|
11
|
-
if defined?(SimpleCov::SourceFile)
|
12
|
-
mod = SimpleCov::SourceFile
|
13
|
-
def mod.new(*args, &block)
|
14
|
-
m = allocate
|
15
|
-
m.instance_eval do
|
16
|
-
begin
|
17
|
-
initialize(*args, &block)
|
18
|
-
rescue Encoding::UndefinedConversionError
|
19
|
-
@src = "".force_encoding('UTF-8')
|
20
|
-
end
|
21
|
-
end
|
22
|
-
m
|
23
|
-
end
|
24
|
-
end
|
25
|
-
SimpleCov.start do
|
26
|
-
add_filter 'spec/'
|
27
|
-
add_filter 'pkg/'
|
28
|
-
add_filter 'vendor/'
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
if ENV['GC_STRESS']
|
33
|
-
STDERR.puts "enable GC.stress"
|
34
|
-
GC.stress = true
|
35
|
-
end
|
36
|
-
|
37
|
-
require 'fluent/log'
|
38
|
-
require 'fluent/plugin'
|
39
|
-
|
40
|
-
class DummyLogDevice
|
41
|
-
attr_reader :logs
|
42
|
-
def initialize ; @logs = [] ; end
|
43
|
-
def tty? ; false ; end
|
44
|
-
def puts(*args) ; args.each{ |arg| write(arg + "\n") } ; end
|
45
|
-
def write(message) ; @logs.push message ; end
|
46
|
-
def flush ; true ; end
|
47
|
-
def close ; true ; end
|
48
|
-
end
|
49
|
-
|
50
|
-
class TestLogger < Fluent::PluginLogger
|
51
|
-
def initialize
|
52
|
-
@logdev = DummyLogDevice.new
|
53
|
-
super(Fluent::Log.new(@logdev))
|
54
|
-
end
|
55
|
-
def logs
|
56
|
-
@logdev.logs
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
$log ||= TestLogger.new
|