fluentd 1.10.2-x64-mingw32 → 1.11.2-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 (68) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +102 -1
  3. data/CONTRIBUTING.md +1 -1
  4. data/example/copy_roundrobin.conf +3 -3
  5. data/example/counter.conf +1 -1
  6. data/example/filter_stdout.conf +2 -2
  7. data/example/{in_dummy_blocks.conf → in_sample_blocks.conf} +4 -4
  8. data/example/{in_dummy_with_compression.conf → in_sample_with_compression.conf} +3 -3
  9. data/example/logevents.conf +5 -5
  10. data/example/multi_filters.conf +1 -1
  11. data/example/out_exec_filter.conf +2 -2
  12. data/example/out_forward.conf +1 -1
  13. data/example/out_forward_buf_file.conf +1 -1
  14. data/example/out_forward_client.conf +5 -5
  15. data/example/out_forward_heartbeat_none.conf +1 -1
  16. data/example/out_forward_sd.conf +1 -1
  17. data/example/out_forward_shared_key.conf +2 -2
  18. data/example/out_forward_tls.conf +1 -1
  19. data/example/out_forward_users.conf +3 -3
  20. data/example/out_null.conf +4 -4
  21. data/example/secondary_file.conf +1 -1
  22. data/lib/fluent/command/fluentd.rb +11 -0
  23. data/lib/fluent/config.rb +1 -0
  24. data/lib/fluent/match.rb +10 -1
  25. data/lib/fluent/plugin/buffer.rb +24 -4
  26. data/lib/fluent/plugin/in_dummy.rb +2 -123
  27. data/lib/fluent/plugin/in_forward.rb +2 -2
  28. data/lib/fluent/plugin/in_gc_stat.rb +16 -0
  29. data/lib/fluent/plugin/in_http.rb +148 -77
  30. data/lib/fluent/plugin/in_monitor_agent.rb +1 -1
  31. data/lib/fluent/plugin/in_sample.rb +141 -0
  32. data/lib/fluent/plugin/in_tail.rb +4 -4
  33. data/lib/fluent/plugin/in_unix.rb +77 -77
  34. data/lib/fluent/plugin/out_file.rb +1 -1
  35. data/lib/fluent/plugin/out_forward.rb +7 -2
  36. data/lib/fluent/plugin/out_forward/load_balancer.rb +1 -1
  37. data/lib/fluent/plugin/out_http.rb +15 -2
  38. data/lib/fluent/plugin/parser_multiline.rb +1 -1
  39. data/lib/fluent/plugin/parser_syslog.rb +215 -54
  40. data/lib/fluent/plugin_helper/cert_option.rb +5 -8
  41. data/lib/fluent/plugin_helper/child_process.rb +3 -2
  42. data/lib/fluent/plugin_helper/record_accessor.rb +14 -0
  43. data/lib/fluent/plugin_helper/service_discovery.rb +7 -0
  44. data/lib/fluent/plugin_helper/service_discovery/manager.rb +8 -0
  45. data/lib/fluent/plugin_helper/socket.rb +1 -1
  46. data/lib/fluent/plugin_helper/socket_option.rb +2 -2
  47. data/lib/fluent/supervisor.rb +6 -3
  48. data/lib/fluent/test/filter_test.rb +2 -2
  49. data/lib/fluent/test/output_test.rb +3 -3
  50. data/lib/fluent/version.rb +1 -1
  51. data/test/plugin/out_forward/test_load_balancer.rb +46 -0
  52. data/test/plugin/test_in_gc_stat.rb +24 -1
  53. data/test/plugin/test_in_http.rb +57 -0
  54. data/test/plugin/{test_in_dummy.rb → test_in_sample.rb} +25 -25
  55. data/test/plugin/test_in_tail.rb +17 -0
  56. data/test/plugin/test_in_unix.rb +128 -73
  57. data/test/plugin/test_out_http.rb +38 -0
  58. data/test/plugin/test_parser_syslog.rb +66 -29
  59. data/test/plugin_helper/data/cert/empty.pem +0 -0
  60. data/test/plugin_helper/test_cert_option.rb +7 -0
  61. data/test/plugin_helper/test_child_process.rb +15 -0
  62. data/test/plugin_helper/test_record_accessor.rb +41 -0
  63. data/test/plugin_helper/test_server.rb +34 -0
  64. data/test/plugin_helper/test_service_discovery.rb +37 -4
  65. data/test/plugin_helper/test_socket.rb +8 -0
  66. data/test/test_match.rb +11 -0
  67. data/test/test_static_config_analysis.rb +2 -2
  68. metadata +9 -6
File without changes
@@ -15,4 +15,11 @@ class CertOptionPluginHelperTest < Test::Unit::TestCase
15
15
  certs = d.cert_option_certificates_from_file("test/plugin_helper/data/cert/cert-with-CRLF.pem")
16
16
  assert_equal(1, certs.length)
17
17
  end
18
+
19
+ test 'raise an error for broken certificates_from_file file' do
20
+ d = Dummy.new
21
+ assert_raise Fluent::ConfigError do
22
+ certs = d.cert_option_certificates_from_file("test/plugin_helper/data/cert/empty.pem")
23
+ end
24
+ end
18
25
  end
@@ -818,5 +818,20 @@ class ChildProcessTest < Test::Unit::TestCase
818
818
  end
819
819
  assert File.exist?(@temp_path)
820
820
  end
821
+
822
+ test 'execute child process writing data to stdout which is unread' do
823
+ callback_called = false
824
+ exit_status = nil
825
+ prog = "echo writing to stdout"
826
+ callback = ->(status){ exit_status = status; callback_called = true }
827
+ Timeout.timeout(TEST_DEADLOCK_TIMEOUT) do
828
+ @d.child_process_execute(:out_exec_process, prog, stderr: :connect, immediate: true, parallel: true, mode: [], wait_timeout: 1, on_exit_callback: callback)
829
+ sleep TEST_WAIT_INTERVAL_FOR_BLOCK_RUNNING until callback_called
830
+ end
831
+ assert callback_called
832
+ assert exit_status
833
+ assert exit_status.success?
834
+ assert_equal 0, exit_status.exitstatus
835
+ end
821
836
  end
822
837
  end
@@ -194,4 +194,45 @@ class RecordAccessorHelperTest < Test::Unit::TestCase
194
194
  end
195
195
  end
196
196
  end
197
+
198
+ sub_test_case 'Fluent::PluginHelper::RecordAccessor::Accessor#set' do
199
+ setup do
200
+ @d = Dummy.new
201
+ end
202
+
203
+ data('normal' => 'key1',
204
+ 'space' => 'ke y2',
205
+ 'dot key' => 'this.is.key3')
206
+ test 'set top key' do |param|
207
+ r = {'key1' => 'v1', 'ke y2' => 'v2', 'this.is.key3' => 'v3'}
208
+ accessor = @d.record_accessor_create(param)
209
+ accessor.set(r, "test")
210
+ assert_equal "test", r[param]
211
+ end
212
+
213
+ test "set top key using bracket style" do
214
+ r = {'key1' => 'v1', 'ke y2' => 'v2', 'this.is.key3' => 'v3'}
215
+ accessor = @d.record_accessor_create('$["this.is.key3"]')
216
+ accessor.set(r, "test")
217
+ assert_equal "test", r["this.is.key3"]
218
+ end
219
+
220
+ data('bracket' => "$['key1'][0]['ke y2']",
221
+ 'bracket w/ double quotes' => '$["key1"][0]["ke y2"]')
222
+ test "set nested keys ['key1', 0, 'ke y2']" do |param|
223
+ r = {'key1' => [{'ke y2' => "value"}]}
224
+ accessor = @d.record_accessor_create(param)
225
+ accessor.set(r, "nested_message")
226
+ assert_equal "nested_message", r['key1'][0]['ke y2']
227
+ end
228
+
229
+ test "don't raise an error when unexpected record is coming" do
230
+ r = {'key1' => [{'key3' => "value"}]}
231
+ accessor = @d.record_accessor_create("$['key1']['key2']['key3']")
232
+ assert_nothing_raised do
233
+ accessor.set(r, "unknown field")
234
+ end
235
+ assert_equal({'key1' => [{'key3' => "value"}]}, r)
236
+ end
237
+ end
197
238
  end
@@ -1233,6 +1233,40 @@ class ServerPluginHelperTest < Test::Unit::TestCase
1233
1233
  waiting(10){ sleep 0.1 until received.bytesize == 8 }
1234
1234
  assert_equal "yay\nfoo\n", received
1235
1235
  end
1236
+
1237
+ test 'set ciphers' do
1238
+ cert_path = File.join(@server_cert_dir, "cert.pem")
1239
+ private_key_path = File.join(@certs_dir, "server.key.pem")
1240
+ create_server_pair_signed_by_self(cert_path, private_key_path, nil)
1241
+ tls_options = {
1242
+ protocol: :tls,
1243
+ version: :TLSv1_2,
1244
+ ciphers: 'SHA256',
1245
+ insecure: false,
1246
+ cert_path: cert_path,
1247
+ private_key_path: private_key_path,
1248
+ }
1249
+ conf = @d.server_create_transport_section_object(tls_options)
1250
+ ctx = @d.cert_option_create_context(conf.version, conf.insecure, conf.ciphers, conf)
1251
+ matched = false
1252
+ ctx.ciphers.each do |cipher|
1253
+ cipher_name, tls_version = cipher
1254
+ # OpenSSL 1.0.2: "TLSv1/SSLv3"
1255
+ # OpenSSL 1.1.1: "TLSv1.2"
1256
+ if tls_version == "TLSv1/SSLv3" || tls_version == "TLSv1.2"
1257
+ matched = true
1258
+ unless cipher_name.match(/#{conf.ciphers}/)
1259
+ matched = false
1260
+ break
1261
+ end
1262
+ end
1263
+ end
1264
+
1265
+ error_msg = build_message("Unexpected ciphers for #{conf.version}",
1266
+ "<?>\nwas expected to include only <?> ciphers for #{conf.version}",
1267
+ ctx.ciphers, conf.ciphers)
1268
+ assert(matched, error_msg)
1269
+ end
1236
1270
  end
1237
1271
  end
1238
1272
 
@@ -4,9 +4,6 @@ require 'fluent/plugin_helper/service_discovery'
4
4
  require 'fluent/plugin/output'
5
5
 
6
6
  class ServiceDiscoveryHelper < Test::Unit::TestCase
7
- PORT = unused_port
8
- NULL_LOGGER = Logger.new(nil)
9
-
10
7
  class Dummy < Fluent::Plugin::TestBase
11
8
  helpers :service_discovery
12
9
 
@@ -30,6 +27,7 @@ class ServiceDiscoveryHelper < Test::Unit::TestCase
30
27
  if @d
31
28
  @d.stop unless @d.stopped?
32
29
  @d.shutdown unless @d.shutdown?
30
+ @d.after_shutdown unless @d.after_shutdown?
33
31
  @d.close unless @d.closed?
34
32
  @d.terminate unless @d.terminated?
35
33
  end
@@ -40,7 +38,7 @@ class ServiceDiscoveryHelper < Test::Unit::TestCase
40
38
 
41
39
  d.service_discovery_create_manager(
42
40
  :service_discovery_helper_test,
43
- configurations: [{ type: :static, conf: config_element('root', '', {}, [config_element('service', '', { 'host' => '127.0.0.1', 'port' => '1234' })]) }],
41
+ configurations: [{ type: :static, conf: config_element('root', '', {}, [config_element('service', '', { 'host' => '127.0.0.1', 'port' => '1234' })]) }],
44
42
  )
45
43
 
46
44
  assert_true !!d.discovery_manager
@@ -49,6 +47,7 @@ class ServiceDiscoveryHelper < Test::Unit::TestCase
49
47
  mock.proxy(d).timer_execute(:service_discovery_helper_test, anything).never
50
48
 
51
49
  d.start
50
+ d.event_loop_wait_until_start
52
51
 
53
52
  services = d.discovery_manager.services
54
53
  assert_equal 1, services.size
@@ -68,5 +67,39 @@ class ServiceDiscoveryHelper < Test::Unit::TestCase
68
67
  mock.proxy(d.discovery_manager).start.once
69
68
  mock(d).timer_execute(:service_discovery_helper_test, anything).once
70
69
  d.start
70
+ d.event_loop_wait_until_start
71
+ end
72
+
73
+ test 'exits service discovery instances without any errors' do
74
+ d = @d = Dummy.new
75
+ mockv = flexmock('dns_resolver', getaddress: '127.0.0.1')
76
+ .should_receive(:getresources)
77
+ .and_return([Resolv::DNS::Resource::IN::SRV.new(1, 10, 8081, 'service1.example.com')])
78
+ .mock
79
+ mock(Resolv::DNS).new { mockv }
80
+
81
+ d.service_discovery_create_manager(
82
+ :service_discovery_helper_test2,
83
+ configurations: [{ type: :srv, conf: config_element('service_discovery', '', { 'service' => 'service1', 'hostname' => 'example.com' }) }],
84
+ )
85
+
86
+ assert_true !!d.discovery_manager
87
+ mock.proxy(d.discovery_manager).start.once
88
+ mock(d).timer_execute(:service_discovery_helper_test2, anything).once
89
+
90
+ # To avoid claring `@logs` during `terminate` step
91
+ # https://github.com/fluent/fluentd/blob/bc78d889f93dad8c2a4e0ad1ca802546185dacba/lib/fluent/test/log.rb#L33
92
+ mock(d.log).reset.twice
93
+
94
+ d.start
95
+ d.event_loop_wait_until_start
96
+
97
+ d.stop unless d.stopped?
98
+ d.shutdown unless d.shutdown?
99
+ d.after_shutdown unless d.after_shutdown?
100
+ d.close unless d.closed?
101
+ d.terminate unless d.terminated?
102
+
103
+ assert_false(d.log.out.logs.any? { |e| e.match?(/thread doesn't exit correctly/) })
71
104
  end
72
105
  end
@@ -128,4 +128,12 @@ class SocketHelperTest < Test::Unit::TestCase
128
128
  client.close
129
129
  end
130
130
  end
131
+
132
+ test 'with empty cert file' do
133
+ cert_path = File.expand_path(File.dirname(__FILE__) + '/data/cert/empty.pem')
134
+
135
+ assert_raise Fluent::ConfigError do
136
+ SocketHelperTestPlugin.new.socket_create_tls('127.0.0.1', PORT, cert_path: cert_path)
137
+ end
138
+ end
131
139
  end
@@ -101,6 +101,17 @@ class MatchTest < Test::Unit::TestCase
101
101
  assert_or_not_match('a.b.** a.c', 'a.c.d')
102
102
  end
103
103
 
104
+ def test_regex_pattern
105
+ assert_glob_match('/a/', 'a')
106
+ assert_glob_not_match('/a/', 'abc')
107
+ assert_glob_match('/a.*/', 'abc')
108
+ assert_glob_not_match('/b.*/', 'abc')
109
+ assert_glob_match('/a\..*/', 'a.b.c')
110
+ assert_glob_not_match('/(?!a\.).*/', 'a.b.c')
111
+ assert_glob_not_match('/a\..*/', 'b.b.c')
112
+ assert_glob_match('/(?!a\.).*/', 'b.b.c')
113
+ end
114
+
104
115
  #def test_character_class
105
116
  # assert_match('[a]', 'a')
106
117
  # assert_match('[ab]', 'a')
@@ -6,7 +6,7 @@ require 'fluent/plugin/out_forward'
6
6
  require 'fluent/plugin/out_stdout'
7
7
  require 'fluent/plugin/out_exec'
8
8
  require 'fluent/plugin/in_forward'
9
- require 'fluent/plugin/in_dummy'
9
+ require 'fluent/plugin/in_sample'
10
10
  require 'fluent/plugin/filter_grep'
11
11
  require 'fluent/plugin/filter_stdout'
12
12
  require 'fluent/plugin/filter_parser'
@@ -74,7 +74,7 @@ class StaticConfigAnalysisTest < ::Test::Unit::TestCase
74
74
  c = Fluent::Config.parse(conf_data, '(test)', '(test_dir)', true)
75
75
  ret = Fluent::StaticConfigAnalysis.call(c)
76
76
  assert_equal [Fluent::Plugin::ExecOutput, Fluent::Plugin::StdoutOutput, Fluent::Plugin::ForwardOutput], ret.outputs.map(&:plugin).map(&:class)
77
- assert_equal [Fluent::Plugin::DummyInput, Fluent::Plugin::ForwardInput], ret.inputs.map(&:plugin).map(&:class)
77
+ assert_equal [Fluent::Plugin::SampleInput, Fluent::Plugin::ForwardInput], ret.inputs.map(&:plugin).map(&:class)
78
78
  assert_equal [Fluent::Plugin::ParserFilter, Fluent::Plugin::StdoutFilter, Fluent::Plugin::GrepFilter], ret.filters.map(&:plugin).map(&:class)
79
79
  assert_equal 1, ret.labels.size
80
80
  assert_equal '@test', ret.labels[0].name
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: 1.10.2
4
+ version: 1.11.2
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: 2020-04-15 00:00:00.000000000 Z
11
+ date: 2020-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack
@@ -458,8 +458,6 @@ files:
458
458
  - example/copy_roundrobin.conf
459
459
  - example/counter.conf
460
460
  - example/filter_stdout.conf
461
- - example/in_dummy_blocks.conf
462
- - example/in_dummy_with_compression.conf
463
461
  - example/in_forward.conf
464
462
  - example/in_forward_client.conf
465
463
  - example/in_forward_shared_key.conf
@@ -468,6 +466,8 @@ files:
468
466
  - example/in_forward_workers.conf
469
467
  - example/in_http.conf
470
468
  - example/in_out_forward.conf
469
+ - example/in_sample_blocks.conf
470
+ - example/in_sample_with_compression.conf
471
471
  - example/in_syslog.conf
472
472
  - example/in_tail.conf
473
473
  - example/in_tcp.conf
@@ -605,6 +605,7 @@ files:
605
605
  - lib/fluent/plugin/in_http.rb
606
606
  - lib/fluent/plugin/in_monitor_agent.rb
607
607
  - lib/fluent/plugin/in_object_space.rb
608
+ - lib/fluent/plugin/in_sample.rb
608
609
  - lib/fluent/plugin/in_syslog.rb
609
610
  - lib/fluent/plugin/in_tail.rb
610
611
  - lib/fluent/plugin/in_tail/position_file.rb
@@ -815,13 +816,13 @@ files:
815
816
  - test/plugin/test_formatter_single_value.rb
816
817
  - test/plugin/test_formatter_tsv.rb
817
818
  - test/plugin/test_in_debug_agent.rb
818
- - test/plugin/test_in_dummy.rb
819
819
  - test/plugin/test_in_exec.rb
820
820
  - test/plugin/test_in_forward.rb
821
821
  - test/plugin/test_in_gc_stat.rb
822
822
  - test/plugin/test_in_http.rb
823
823
  - test/plugin/test_in_monitor_agent.rb
824
824
  - test/plugin/test_in_object_space.rb
825
+ - test/plugin/test_in_sample.rb
825
826
  - test/plugin/test_in_syslog.rb
826
827
  - test/plugin/test_in_tail.rb
827
828
  - test/plugin/test_in_tcp.rb
@@ -877,6 +878,7 @@ files:
877
878
  - test/plugin_helper/data/cert/cert_chains/ca-cert.pem
878
879
  - test/plugin_helper/data/cert/cert_chains/cert-key.pem
879
880
  - test/plugin_helper/data/cert/cert_chains/cert.pem
881
+ - test/plugin_helper/data/cert/empty.pem
880
882
  - test/plugin_helper/data/cert/generate_cert.rb
881
883
  - test/plugin_helper/data/cert/with_ca/ca-cert-key-pass.pem
882
884
  - test/plugin_helper/data/cert/with_ca/ca-cert-key.pem
@@ -1048,13 +1050,13 @@ test_files:
1048
1050
  - test/plugin/test_formatter_single_value.rb
1049
1051
  - test/plugin/test_formatter_tsv.rb
1050
1052
  - test/plugin/test_in_debug_agent.rb
1051
- - test/plugin/test_in_dummy.rb
1052
1053
  - test/plugin/test_in_exec.rb
1053
1054
  - test/plugin/test_in_forward.rb
1054
1055
  - test/plugin/test_in_gc_stat.rb
1055
1056
  - test/plugin/test_in_http.rb
1056
1057
  - test/plugin/test_in_monitor_agent.rb
1057
1058
  - test/plugin/test_in_object_space.rb
1059
+ - test/plugin/test_in_sample.rb
1058
1060
  - test/plugin/test_in_syslog.rb
1059
1061
  - test/plugin/test_in_tail.rb
1060
1062
  - test/plugin/test_in_tcp.rb
@@ -1110,6 +1112,7 @@ test_files:
1110
1112
  - test/plugin_helper/data/cert/cert_chains/ca-cert.pem
1111
1113
  - test/plugin_helper/data/cert/cert_chains/cert-key.pem
1112
1114
  - test/plugin_helper/data/cert/cert_chains/cert.pem
1115
+ - test/plugin_helper/data/cert/empty.pem
1113
1116
  - test/plugin_helper/data/cert/generate_cert.rb
1114
1117
  - test/plugin_helper/data/cert/with_ca/ca-cert-key-pass.pem
1115
1118
  - test/plugin_helper/data/cert/with_ca/ca-cert-key.pem