fluentd 0.12.0.pre.1 → 0.12.0.pre.2

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.

Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -1
  3. data/.travis.yml +1 -0
  4. data/ChangeLog +21 -0
  5. data/README.md +10 -2
  6. data/Rakefile +4 -13
  7. data/example/v1_literal_example.conf +36 -0
  8. data/fluentd.gemspec +4 -1
  9. data/lib/fluent/buffer.rb +73 -46
  10. data/lib/fluent/command/fluentd.rb +7 -2
  11. data/lib/fluent/config/basic_parser.rb +5 -0
  12. data/lib/fluent/config/element.rb +2 -5
  13. data/lib/fluent/config/literal_parser.rb +26 -7
  14. data/lib/fluent/config/section.rb +2 -0
  15. data/lib/fluent/config/v1_parser.rb +9 -2
  16. data/lib/fluent/formatter.rb +2 -1
  17. data/lib/fluent/mixin.rb +22 -7
  18. data/lib/fluent/output.rb +17 -8
  19. data/lib/fluent/parser.rb +14 -3
  20. data/lib/fluent/plugin/buf_file.rb +30 -15
  21. data/lib/fluent/plugin/filter_grep.rb +69 -0
  22. data/lib/fluent/plugin/filter_record_transformer.rb +183 -0
  23. data/lib/fluent/plugin/in_exec.rb +6 -0
  24. data/lib/fluent/plugin/in_forward.rb +34 -4
  25. data/lib/fluent/plugin/in_http.rb +1 -1
  26. data/lib/fluent/plugin/out_exec.rb +1 -1
  27. data/lib/fluent/plugin/out_exec_filter.rb +8 -1
  28. data/lib/fluent/plugin/out_forward.rb +82 -4
  29. data/lib/fluent/supervisor.rb +1 -1
  30. data/lib/fluent/timezone.rb +131 -0
  31. data/lib/fluent/version.rb +1 -1
  32. data/test/config/assertions.rb +42 -0
  33. data/test/config/test_config_parser.rb +385 -0
  34. data/test/config/test_configurable.rb +530 -0
  35. data/test/config/test_configure_proxy.rb +99 -0
  36. data/test/config/test_dsl.rb +237 -0
  37. data/test/config/test_literal_parser.rb +293 -0
  38. data/test/config/test_section.rb +112 -0
  39. data/test/config/test_system_config.rb +49 -0
  40. data/test/helper.rb +25 -0
  41. data/test/plugin/test_buf_file.rb +604 -0
  42. data/test/plugin/test_buf_memory.rb +204 -0
  43. data/test/plugin/test_filter_grep.rb +124 -0
  44. data/test/plugin/test_filter_record_transformer.rb +251 -0
  45. data/test/plugin/test_in_exec.rb +1 -0
  46. data/test/plugin/test_in_forward.rb +205 -2
  47. data/test/plugin/test_in_gc_stat.rb +1 -0
  48. data/test/plugin/test_in_http.rb +58 -2
  49. data/test/plugin/test_in_object_space.rb +1 -0
  50. data/test/plugin/test_in_status.rb +1 -0
  51. data/test/plugin/test_in_stream.rb +1 -1
  52. data/test/plugin/test_in_syslog.rb +1 -1
  53. data/test/plugin/test_in_tail.rb +1 -0
  54. data/test/plugin/test_in_tcp.rb +1 -1
  55. data/test/plugin/test_in_udp.rb +1 -1
  56. data/test/plugin/test_out_copy.rb +1 -0
  57. data/test/plugin/test_out_exec.rb +1 -0
  58. data/test/plugin/test_out_exec_filter.rb +1 -0
  59. data/test/plugin/test_out_file.rb +36 -0
  60. data/test/plugin/test_out_forward.rb +279 -8
  61. data/test/plugin/test_out_roundrobin.rb +1 -0
  62. data/test/plugin/test_out_stdout.rb +1 -0
  63. data/test/plugin/test_out_stream.rb +1 -1
  64. data/test/test_buffer.rb +530 -0
  65. data/test/test_config.rb +1 -1
  66. data/test/test_configdsl.rb +1 -1
  67. data/test/test_formatter.rb +223 -0
  68. data/test/test_match.rb +1 -2
  69. data/test/test_mixin.rb +74 -2
  70. data/test/test_parser.rb +7 -1
  71. metadata +88 -35
  72. data/lib/fluent/plugin/buf_zfile.rb +0 -75
  73. data/spec/config/config_parser_spec.rb +0 -314
  74. data/spec/config/configurable_spec.rb +0 -524
  75. data/spec/config/configure_proxy_spec.rb +0 -96
  76. data/spec/config/dsl_spec.rb +0 -239
  77. data/spec/config/helper.rb +0 -49
  78. data/spec/config/literal_parser_spec.rb +0 -222
  79. data/spec/config/section_spec.rb +0 -97
  80. data/spec/config/system_config_spec.rb +0 -49
  81. data/spec/spec_helper.rb +0 -60
@@ -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