fluentd 0.14.13-x64-mingw32 → 0.14.17-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.

Files changed (67) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +4 -5
  3. data/ChangeLog +106 -0
  4. data/MAINTAINERS.md +5 -0
  5. data/README.md +25 -0
  6. data/example/worker_section.conf +36 -0
  7. data/fluentd.gemspec +1 -1
  8. data/lib/fluent/agent.rb +5 -2
  9. data/lib/fluent/command/binlog_reader.rb +1 -0
  10. data/lib/fluent/command/fluentd.rb +28 -12
  11. data/lib/fluent/command/plugin_config_formatter.rb +0 -1
  12. data/lib/fluent/command/plugin_generator.rb +1 -1
  13. data/lib/fluent/compat/detach_process_mixin.rb +8 -0
  14. data/lib/fluent/compat/input.rb +0 -10
  15. data/lib/fluent/compat/output.rb +0 -10
  16. data/lib/fluent/config/element.rb +22 -0
  17. data/lib/fluent/config/literal_parser.rb +2 -0
  18. data/lib/fluent/config/types.rb +2 -2
  19. data/lib/fluent/engine.rb +27 -10
  20. data/lib/fluent/env.rb +3 -3
  21. data/lib/fluent/log.rb +4 -1
  22. data/lib/fluent/plugin/base.rb +3 -0
  23. data/lib/fluent/plugin/filter.rb +2 -2
  24. data/lib/fluent/plugin/filter_parser.rb +17 -6
  25. data/lib/fluent/plugin/in_forward.rb +1 -1
  26. data/lib/fluent/plugin/in_http.rb +4 -0
  27. data/lib/fluent/plugin/in_monitor_agent.rb +8 -3
  28. data/lib/fluent/plugin/in_syslog.rb +3 -2
  29. data/lib/fluent/plugin/in_tail.rb +14 -3
  30. data/lib/fluent/plugin/in_udp.rb +6 -2
  31. data/lib/fluent/plugin/out_file.rb +5 -0
  32. data/lib/fluent/plugin/out_forward.rb +5 -2
  33. data/lib/fluent/plugin/output.rb +13 -8
  34. data/lib/fluent/plugin/parser_apache2.rb +1 -1
  35. data/lib/fluent/plugin/parser_syslog.rb +40 -1
  36. data/lib/fluent/plugin_helper/cert_option.rb +2 -2
  37. data/lib/fluent/plugin_helper/compat_parameters.rb +1 -1
  38. data/lib/fluent/plugin_helper/storage.rb +1 -1
  39. data/lib/fluent/root_agent.rb +36 -4
  40. data/lib/fluent/supervisor.rb +37 -6
  41. data/lib/fluent/system_config.rb +7 -0
  42. data/lib/fluent/time.rb +1 -0
  43. data/lib/fluent/version.rb +1 -1
  44. data/lib/fluent/winsvc.rb +25 -11
  45. data/test/command/test_fluentd.rb +253 -4
  46. data/test/config/test_element.rb +63 -0
  47. data/test/config/test_literal_parser.rb +1 -1
  48. data/test/config/test_system_config.rb +36 -6
  49. data/test/config/test_types.rb +19 -0
  50. data/test/plugin/test_filter_parser.rb +35 -0
  51. data/test/plugin/test_in_http.rb +58 -4
  52. data/test/plugin/test_in_monitor_agent.rb +90 -9
  53. data/test/plugin/test_in_tail.rb +16 -0
  54. data/test/plugin/test_in_udp.rb +11 -1
  55. data/test/plugin/test_out_file.rb +9 -0
  56. data/test/plugin/test_out_forward.rb +45 -0
  57. data/test/plugin/test_output.rb +15 -15
  58. data/test/plugin/test_output_as_buffered.rb +30 -2
  59. data/test/plugin/test_parser_apache2.rb +8 -0
  60. data/test/plugin/test_parser_syslog.rb +176 -0
  61. data/test/plugin_helper/test_server.rb +37 -31
  62. data/test/plugin_helper/test_storage.rb +9 -0
  63. data/test/test_log.rb +6 -0
  64. data/test/test_plugin_classes.rb +50 -0
  65. data/test/test_root_agent.rb +245 -14
  66. data/test/test_time_parser.rb +12 -0
  67. metadata +13 -5
@@ -99,6 +99,15 @@ class StorageHelperTest < Test::Unit::TestCase
99
99
  assert_equal 0, d._storages.size
100
100
  end
101
101
 
102
+ test 'can be configured with hash' do
103
+ d = Dummy.new
104
+ d.configure(config_element())
105
+ conf = { '@type' => 'example' }
106
+ assert_nothing_raised do
107
+ d.storage_create(conf: conf)
108
+ end
109
+ end
110
+
102
111
  test 'can override default configuration parameters, but not overwrite whole definition' do
103
112
  d = Dummy.new
104
113
  d.configure(config_element())
@@ -720,6 +720,12 @@ class PluginLoggerTest < Test::Unit::TestCase
720
720
  @log.write("log")
721
721
  end
722
722
 
723
+ def test_write_alias
724
+ assert(@log.respond_to?(:<<))
725
+ mock(@log.out).write("log")
726
+ @log << "log"
727
+ end
728
+
723
729
  def test_out
724
730
  assert_equal(@log.out, @logger.out)
725
731
  @log.out = Object.new
@@ -21,6 +21,28 @@ module FluentTest
21
21
  end
22
22
  end
23
23
 
24
+ class FluentTestGenInput < ::Fluent::Plugin::Input
25
+ ::Fluent::Plugin.register_input('test_in_gen', self)
26
+
27
+ attr_reader :started
28
+
29
+ config_param :num, :integer, default: 10000
30
+
31
+ def start
32
+ super
33
+ @started = true
34
+
35
+ @num.times { |i|
36
+ router.emit("test.evet", Fluent::EventTime.now, {'message' => 'Hello!', 'key' => "value#{i}", 'num' => i})
37
+ }
38
+ end
39
+
40
+ def shutdown
41
+ @started = false
42
+ super
43
+ end
44
+ end
45
+
24
46
  class FluentTestOutput < ::Fluent::Plugin::Output
25
47
  ::Fluent::Plugin.register_output('test_out', self)
26
48
 
@@ -112,6 +134,19 @@ module FluentTest
112
134
 
113
135
  class FluentTestBufferedOutput < ::Fluent::Plugin::Output
114
136
  ::Fluent::Plugin.register_output('test_out_buffered', self)
137
+
138
+ attr_reader :started
139
+
140
+ def start
141
+ super
142
+ @started = true
143
+ end
144
+
145
+ def shutdown
146
+ @started = false
147
+ super
148
+ end
149
+
115
150
  def write(chunk)
116
151
  # drop everything
117
152
  end
@@ -200,6 +235,21 @@ module FluentTest
200
235
  end
201
236
  end
202
237
 
238
+ class FluentTestBuffer < Fluent::Plugin::Buffer
239
+ ::Fluent::Plugin.register_buffer('test_buffer', self)
240
+
241
+ def resume
242
+ return {}, []
243
+ end
244
+
245
+ def generate_chunk(metadata)
246
+ end
247
+
248
+ def multi_workers_ready?
249
+ false
250
+ end
251
+ end
252
+
203
253
  class TestEmitErrorHandler
204
254
  def initialize
205
255
  @events = Hash.new { |h, k| h[k] = [] }
@@ -174,10 +174,15 @@ EOC
174
174
  end
175
175
 
176
176
  sub_test_case 'start/shutdown' do
177
- setup do
178
- @ra = RootAgent.new(log: $log)
179
- stub(Engine).root_agent { @ra }
180
- @ra.configure(Config.parse(<<-EOC, "(test)", "(test_dir)", true))
177
+ def setup_root_agent(conf)
178
+ ra = RootAgent.new(log: $log)
179
+ stub(Engine).root_agent { ra }
180
+ ra.configure(Config.parse(conf, "(test)", "(test_dir)", true))
181
+ ra
182
+ end
183
+
184
+ test 'plugin status' do
185
+ ra = setup_root_agent(<<-EOC)
181
186
  <source>
182
187
  @type test_in
183
188
  @id test_in
@@ -191,19 +196,41 @@ EOC
191
196
  @id test_out
192
197
  </match>
193
198
  EOC
194
- @ra
199
+ ra.start
200
+ assert_true ra.inputs.first.started
201
+ assert_true ra.filters.first.started
202
+ assert_true ra.outputs.first.started
203
+
204
+ ra.shutdown
205
+ assert_false ra.inputs.first.started
206
+ assert_false ra.filters.first.started
207
+ assert_false ra.outputs.first.started
195
208
  end
196
209
 
197
- test 'plugin status' do
198
- @ra.start
199
- assert_true @ra.inputs.first.started
200
- assert_true @ra.filters.first.started
201
- assert_true @ra.outputs.first.started
210
+ test 'output plugin threads should run before input plugin is blocked with buffer full' do
211
+ ra = setup_root_agent(<<-EOC)
212
+ <source>
213
+ @type test_in_gen
214
+ @id test_in_gen
215
+ </source>
216
+ <match **>
217
+ @type test_out_buffered
218
+ @id test_out_buffered
219
+ <buffer>
220
+ chunk_limit_size 1k
221
+ queue_limit_length 2
222
+ flush_thread_count 2
223
+ overflow_action block
224
+ </buffer>
225
+ </match>
226
+ EOC
227
+ waiting(5) { ra.start }
228
+ assert_true ra.inputs.first.started
229
+ assert_true ra.outputs.first.started
202
230
 
203
- @ra.shutdown
204
- assert_false @ra.inputs.first.started
205
- assert_false @ra.filters.first.started
206
- assert_false @ra.outputs.first.started
231
+ ra.shutdown
232
+ assert_false ra.inputs.first.started
233
+ assert_false ra.outputs.first.started
207
234
  end
208
235
  end
209
236
 
@@ -581,4 +608,208 @@ EOC
581
608
  assert_equal [true, true], dyn_out.child.outputs.map{|i| i.terminated? }
582
609
  end
583
610
  end
611
+
612
+ sub_test_case 'configured at worker2 with 4 workers environment' do
613
+ setup do
614
+ ENV['SERVERENGINE_WORKER_ID'] = '2'
615
+ @ra = RootAgent.new(log: $log)
616
+ system_config = SystemConfig.new
617
+ system_config.workers = 4
618
+ stub(Engine).worker_id { 2 }
619
+ stub(Engine).root_agent { @ra }
620
+ stub(Engine).system_config { system_config }
621
+ @ra
622
+ end
623
+
624
+ teardown '' do
625
+ ENV.delete('SERVERENGINE_WORKER_ID')
626
+ end
627
+
628
+ def configure_ra(conf_str)
629
+ conf = Config.parse(conf_str, "(test)", "(test_dir)", true)
630
+ @ra.configure(conf)
631
+ @ra
632
+ end
633
+
634
+ test 'raises configuration error for missing worker id' do
635
+ errmsg = 'Missing worker id on <worker> directive'
636
+ assert_raise Fluent::ConfigError.new(errmsg) do
637
+ conf = <<-EOC
638
+ <worker>
639
+ </worker>
640
+ EOC
641
+ configure_ra(conf)
642
+ end
643
+ end
644
+
645
+ test 'raises configuration error for too big worker id' do
646
+ errmsg = "worker id 4 specified by <worker> directive is not allowed. Available worker id is between 0 and 3"
647
+ assert_raise Fluent::ConfigError.new(errmsg) do
648
+ conf = <<-EOC
649
+ <worker 4>
650
+ </worker>
651
+ EOC
652
+ configure_ra(conf)
653
+ end
654
+ end
655
+
656
+ test 'raises configuration error for invalid elements as a child of worker section' do
657
+ errmsg = '<worker> section cannot have <system> directive'
658
+ assert_raise Fluent::ConfigError.new(errmsg) do
659
+ conf = <<-EOC
660
+ <worker 2>
661
+ <system>
662
+ </system>
663
+ </worker>
664
+ EOC
665
+ configure_ra(conf)
666
+ end
667
+ end
668
+
669
+ test 'raises configuration error when configured plugins do not have support multi worker configuration' do
670
+ errmsg = "Plugin 'test_out' does not support multi workers configuration (FluentTest::FluentTestOutput)"
671
+ assert_raise Fluent::ConfigError.new(errmsg) do
672
+ conf = <<-EOC
673
+ <match **>
674
+ @type test_out
675
+ </match>
676
+ EOC
677
+ configure_ra(conf)
678
+ end
679
+ end
680
+
681
+ test 'does not raise configuration error when configured plugins in worker section do not have support multi worker configuration' do
682
+ assert_nothing_raised do
683
+ conf = <<-EOC
684
+ <worker 2>
685
+ <match **>
686
+ @type test_out
687
+ </match>
688
+ </worker>
689
+ EOC
690
+ configure_ra(conf)
691
+ end
692
+ end
693
+
694
+ test 'does not raise configuration error when configured plugins as a children of MultiOutput in worker section do not have support multi worker configuration' do
695
+ assert_nothing_raised do
696
+ conf = <<-EOC
697
+ <worker 2>
698
+ <match **>
699
+ @type copy
700
+ <store>
701
+ @type test_out
702
+ </store>
703
+ <store>
704
+ @type test_out
705
+ </store>
706
+ </match>
707
+ </worker>
708
+ EOC
709
+ configure_ra(conf)
710
+ end
711
+ end
712
+
713
+ test 'does not raise configuration error when configured plugins owned by plugin do not have support multi worker configuration' do
714
+ assert_nothing_raised do
715
+ conf = <<-EOC
716
+ <worker 2>
717
+ <match **>
718
+ @type test_out_buffered
719
+ <buffer>
720
+ @type test_buffer
721
+ </buffer>
722
+ </match>
723
+ </worker>
724
+ EOC
725
+ configure_ra(conf)
726
+ end
727
+ end
728
+
729
+ test 'with plugins' do
730
+ conf = <<-EOC
731
+ <worker 2>
732
+ <source>
733
+ @type test_in
734
+ @id test_in
735
+ </source>
736
+ <filter>
737
+ type test_filter
738
+ id test_filter
739
+ </filter>
740
+ <match **>
741
+ @type relabel
742
+ @id test_relabel
743
+ @label @test
744
+ </match>
745
+ <label @test>
746
+ <match **>
747
+ type test_out
748
+ id test_out
749
+ </match>
750
+ </label>
751
+ <label @ERROR>
752
+ <match>
753
+ @type null
754
+ </match>
755
+ </label>
756
+ </worker>
757
+ EOC
758
+ ra = configure_ra(conf)
759
+ assert_kind_of FluentTestInput, ra.inputs.first
760
+ assert_kind_of Plugin::RelabelOutput, ra.outputs.first
761
+ assert_kind_of FluentTestFilter, ra.filters.first
762
+ assert ra.error_collector
763
+
764
+ %W(@test @ERROR).each { |label_symbol|
765
+ assert_include ra.labels, label_symbol
766
+ assert_kind_of Label, ra.labels[label_symbol]
767
+ }
768
+
769
+ test_label = ra.labels['@test']
770
+ assert_kind_of FluentTestOutput, test_label.outputs.first
771
+ assert_equal ra, test_label.root_agent
772
+
773
+ error_label = ra.labels['@ERROR']
774
+ assert_kind_of Fluent::Plugin::NullOutput, error_label.outputs.first
775
+ assert_kind_of RootAgent::RootAgentProxyWithoutErrorCollector, error_label.root_agent
776
+ end
777
+
778
+ test 'with plugins but for another worker' do
779
+ conf = <<-EOC
780
+ <worker 0>
781
+ <source>
782
+ @type test_in
783
+ @id test_in
784
+ </source>
785
+ <filter>
786
+ type test_filter
787
+ id test_filter
788
+ </filter>
789
+ <match **>
790
+ @type relabel
791
+ @id test_relabel
792
+ @label @test
793
+ </match>
794
+ <label @test>
795
+ <match **>
796
+ type test_out
797
+ id test_out
798
+ </match>
799
+ </label>
800
+ <label @ERROR>
801
+ <match>
802
+ @type null
803
+ </match>
804
+ </label>
805
+ </worker>
806
+ EOC
807
+ ra = configure_ra(conf)
808
+ assert_equal 0, ra.inputs.size
809
+ assert_equal 0, ra.outputs.size
810
+ assert_equal 0, ra.filters.size
811
+ assert_equal 0, ra.labels.size
812
+ refute ra.error_collector
813
+ end
814
+ end
584
815
  end
@@ -34,6 +34,18 @@ class TimeParserTest < ::Test::Unit::TestCase
34
34
  assert_equal_event_time(time, parser.parse('28/Feb/2013:12:00:00:123456789 +0900'))
35
35
  end
36
36
 
37
+ def test_parse_iso8601
38
+ parser = Fluent::TimeParser.new('%iso8601')
39
+
40
+ assert(parser.parse('2017-01-01T12:00:00+09:00').is_a?(Fluent::EventTime))
41
+
42
+ time = event_time('2017-01-01T12:00:00+09:00')
43
+ assert_equal(time, parser.parse('2017-01-01T12:00:00+09:00'))
44
+
45
+ time_with_msec = event_time('2017-01-01T12:00:00.123+09:00')
46
+ assert_equal(time_with_msec, parser.parse('2017-01-01T12:00:00.123+09:00'))
47
+ end
48
+
37
49
  def test_parse_with_invalid_argument
38
50
  parser = Fluent::TimeParser.new
39
51
 
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.14.13
4
+ version: 0.14.17
5
5
  platform: x64-mingw32
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-02-21 00:00:00.000000000 Z
11
+ date: 2017-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -48,16 +48,22 @@ dependencies:
48
48
  name: cool.io
49
49
  requirement: !ruby/object:Gem::Requirement
50
50
  requirements:
51
- - - "~>"
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: 1.4.5
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: 2.0.0
54
57
  type: :runtime
55
58
  prerelease: false
56
59
  version_requirements: !ruby/object:Gem::Requirement
57
60
  requirements:
58
- - - "~>"
61
+ - - ">="
59
62
  - !ruby/object:Gem::Version
60
63
  version: 1.4.5
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: 2.0.0
61
67
  - !ruby/object:Gem::Dependency
62
68
  name: serverengine
63
69
  requirement: !ruby/object:Gem::Requirement
@@ -359,6 +365,7 @@ files:
359
365
  - COPYING
360
366
  - ChangeLog
361
367
  - Gemfile
368
+ - MAINTAINERS.md
362
369
  - README.md
363
370
  - Rakefile
364
371
  - Vagrantfile
@@ -404,6 +411,7 @@ files:
404
411
  - example/suppress_config_dump.conf
405
412
  - example/v0_12_filter.conf
406
413
  - example/v1_literal_example.conf
414
+ - example/worker_section.conf
407
415
  - fluent.conf
408
416
  - fluentd.gemspec
409
417
  - lib/fluent/agent.rb
@@ -769,7 +777,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
769
777
  version: '0'
770
778
  requirements: []
771
779
  rubyforge_project:
772
- rubygems_version: 2.5.2
780
+ rubygems_version: 2.6.11
773
781
  signing_key:
774
782
  specification_version: 4
775
783
  summary: Fluentd event collector