fluentd 1.12.2-x86-mingw32 → 1.13.2-x86-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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/.github/ISSUE_TEMPLATE/bug_report.yaml +69 -0
  3. data/.github/ISSUE_TEMPLATE/feature_request.yaml +38 -0
  4. data/.github/workflows/linux-test.yaml +1 -1
  5. data/.github/workflows/windows-test.yaml +19 -3
  6. data/.gitlab-ci.yml +19 -19
  7. data/CHANGELOG.md +153 -0
  8. data/CONTRIBUTING.md +2 -2
  9. data/MAINTAINERS.md +1 -1
  10. data/README.md +8 -5
  11. data/bin/fluentd +8 -1
  12. data/example/counter.conf +1 -1
  13. data/fluentd.gemspec +4 -3
  14. data/lib/fluent/command/cat.rb +19 -3
  15. data/lib/fluent/command/fluentd.rb +1 -2
  16. data/lib/fluent/command/plugin_generator.rb +42 -2
  17. data/lib/fluent/config.rb +1 -1
  18. data/lib/fluent/config/section.rb +5 -0
  19. data/lib/fluent/config/types.rb +15 -0
  20. data/lib/fluent/config/v1_parser.rb +3 -2
  21. data/lib/fluent/env.rb +2 -1
  22. data/lib/fluent/log.rb +1 -0
  23. data/lib/fluent/oj_options.rb +62 -0
  24. data/lib/fluent/plugin/file_wrapper.rb +49 -4
  25. data/lib/fluent/plugin/formatter.rb +1 -0
  26. data/lib/fluent/plugin/formatter_json.rb +9 -7
  27. data/lib/fluent/plugin/in_http.rb +10 -0
  28. data/lib/fluent/plugin/in_tail.rb +150 -39
  29. data/lib/fluent/plugin/in_tail/position_file.rb +15 -1
  30. data/lib/fluent/plugin/out_forward.rb +14 -33
  31. data/lib/fluent/plugin/output.rb +11 -9
  32. data/lib/fluent/plugin/parser_csv.rb +2 -2
  33. data/lib/fluent/plugin/parser_json.rb +2 -3
  34. data/lib/fluent/plugin/parser_syslog.rb +2 -2
  35. data/lib/fluent/plugin/service_discovery.rb +0 -15
  36. data/lib/fluent/plugin/storage_local.rb +1 -1
  37. data/lib/fluent/plugin_helper/http_server/router.rb +1 -1
  38. data/lib/fluent/plugin_helper/server.rb +4 -2
  39. data/lib/fluent/plugin_helper/service_discovery.rb +39 -1
  40. data/lib/fluent/plugin_helper/service_discovery/manager.rb +11 -5
  41. data/lib/fluent/plugin_helper/socket_option.rb +2 -2
  42. data/lib/fluent/supervisor.rb +15 -0
  43. data/lib/fluent/system_config.rb +14 -0
  44. data/lib/fluent/test/driver/storage.rb +30 -0
  45. data/lib/fluent/version.rb +1 -1
  46. data/templates/new_gem/fluent-plugin.gemspec.erb +3 -3
  47. data/templates/new_gem/lib/fluent/plugin/storage.rb.erb +40 -0
  48. data/templates/new_gem/test/plugin/test_storage.rb.erb +18 -0
  49. data/test/command/test_cat.rb +99 -0
  50. data/test/command/test_plugin_generator.rb +2 -1
  51. data/test/config/test_section.rb +9 -0
  52. data/test/config/test_system_config.rb +46 -0
  53. data/test/config/test_types.rb +7 -0
  54. data/test/plugin/in_tail/test_io_handler.rb +4 -4
  55. data/test/plugin/in_tail/test_position_file.rb +54 -0
  56. data/test/plugin/out_forward/test_connection_manager.rb +0 -6
  57. data/test/plugin/test_file_wrapper.rb +115 -0
  58. data/test/plugin/test_in_forward.rb +59 -83
  59. data/test/plugin/test_in_http.rb +58 -40
  60. data/test/plugin/test_in_syslog.rb +66 -56
  61. data/test/plugin/test_in_tail.rb +329 -10
  62. data/test/plugin/test_in_tcp.rb +45 -32
  63. data/test/plugin/test_in_udp.rb +47 -33
  64. data/test/plugin/test_out_forward.rb +138 -105
  65. data/test/plugin/test_out_stream.rb +18 -8
  66. data/test/plugin/test_output.rb +15 -3
  67. data/test/plugin/test_output_as_buffered_backup.rb +2 -0
  68. data/test/plugin/test_parser_csv.rb +14 -0
  69. data/test/plugin/test_parser_syslog.rb +14 -0
  70. data/test/plugin_helper/http_server/test_route.rb +1 -1
  71. data/test/plugin_helper/service_discovery/test_manager.rb +1 -1
  72. data/test/plugin_helper/test_child_process.rb +1 -1
  73. data/test/plugin_helper/test_http_server_helper.rb +34 -27
  74. data/test/plugin_helper/test_server.rb +144 -139
  75. data/test/plugin_helper/test_service_discovery.rb +74 -14
  76. data/test/plugin_helper/test_socket.rb +16 -9
  77. data/test/test_config.rb +2 -1
  78. data/test/test_event_time.rb +2 -2
  79. data/test/test_oj_options.rb +55 -0
  80. data/test/test_output.rb +2 -2
  81. data/test/test_supervisor.rb +35 -0
  82. metadata +41 -11
  83. data/.github/ISSUE_TEMPLATE/bug_report.md +0 -40
  84. data/.github/ISSUE_TEMPLATE/feature_request.md +0 -23
@@ -18,52 +18,55 @@ class ForwardInputTest < Test::Unit::TestCase
18
18
  Fluent::Test.setup
19
19
  @responses = [] # for testing responses after sending data
20
20
  @d = nil
21
+ @port = unused_port
21
22
  end
22
23
 
23
24
  def teardown
24
25
  @d.instance_shutdown if @d
26
+ @port = nil
25
27
  end
26
28
 
27
- PORT = unused_port
28
-
29
29
  SHARED_KEY = 'foobar1'
30
30
  USER_NAME = 'tagomoris'
31
31
  USER_PASSWORD = 'fluentd'
32
32
 
33
- CONFIG = %[
34
- port #{PORT}
35
- bind 127.0.0.1
36
- ]
33
+ def base_config
34
+ %[
35
+ port #{@port}
36
+ bind 127.0.0.1
37
+ ]
38
+ end
37
39
  LOCALHOST_HOSTNAME_GETTER = ->(){sock = UDPSocket.new(::Socket::AF_INET); sock.do_not_reverse_lookup = false; sock.connect("127.0.0.1", 2048); sock.peeraddr[2] }
38
40
  LOCALHOST_HOSTNAME = LOCALHOST_HOSTNAME_GETTER.call
39
41
  DUMMY_SOCK = Struct.new(:remote_host, :remote_addr, :remote_port).new(LOCALHOST_HOSTNAME, "127.0.0.1", 0)
40
- CONFIG_AUTH = %[
41
- port #{PORT}
42
- bind 127.0.0.1
43
- <security>
44
- self_hostname localhost
45
- shared_key foobar1
46
- user_auth true
47
- <user>
48
- username #{USER_NAME}
49
- password #{USER_PASSWORD}
50
- </user>
51
- <client>
52
- network 127.0.0.0/8
53
- shared_key #{SHARED_KEY}
54
- users ["#{USER_NAME}"]
55
- </client>
56
- </security>
57
- ]
58
-
59
- def create_driver(conf=CONFIG)
42
+
43
+ def config_auth
44
+ base_config + %[
45
+ <security>
46
+ self_hostname localhost
47
+ shared_key foobar1
48
+ user_auth true
49
+ <user>
50
+ username #{USER_NAME}
51
+ password #{USER_PASSWORD}
52
+ </user>
53
+ <client>
54
+ network 127.0.0.0/8
55
+ shared_key #{SHARED_KEY}
56
+ users ["#{USER_NAME}"]
57
+ </client>
58
+ </security>
59
+ ]
60
+ end
61
+
62
+ def create_driver(conf=base_config)
60
63
  Fluent::Test::Driver::Input.new(Fluent::Plugin::ForwardInput).configure(conf)
61
64
  end
62
65
 
63
66
  sub_test_case '#configure' do
64
67
  test 'simple' do
65
68
  @d = d = create_driver
66
- assert_equal PORT, d.instance.port
69
+ assert_equal @port, d.instance.port
67
70
  assert_equal '127.0.0.1', d.instance.bind
68
71
  assert_equal 0, d.instance.linger_timeout
69
72
  assert_equal 0.5, d.instance.blocking_timeout
@@ -71,8 +74,8 @@ class ForwardInputTest < Test::Unit::TestCase
71
74
  end
72
75
 
73
76
  test 'auth' do
74
- @d = d = create_driver(CONFIG_AUTH)
75
- assert_equal PORT, d.instance.port
77
+ @d = d = create_driver(config_auth)
78
+ assert_equal @port, d.instance.port
76
79
  assert_equal '127.0.0.1', d.instance.bind
77
80
  assert_equal 0, d.instance.linger_timeout
78
81
  assert !d.instance.backlog
@@ -86,17 +89,17 @@ class ForwardInputTest < Test::Unit::TestCase
86
89
  add_tag_prefix: "add_tag_prefix")
87
90
  test 'tag parameters' do |data|
88
91
  assert_raise(Fluent::ConfigError.new("'#{data}' parameter must not be empty")) {
89
- create_driver(CONFIG + "#{data} ''")
92
+ create_driver(base_config + "#{data} ''")
90
93
  }
91
94
  end
92
95
 
93
96
  test 'send_keepalive_packet is disabled by default' do
94
- @d = d = create_driver(CONFIG_AUTH)
97
+ @d = d = create_driver(config_auth)
95
98
  assert_false d.instance.send_keepalive_packet
96
99
  end
97
100
 
98
101
  test 'send_keepalive_packet can be enabled' do
99
- @d = d = create_driver(CONFIG_AUTH + %[
102
+ @d = d = create_driver(config_auth + %[
100
103
  send_keepalive_packet true
101
104
  ])
102
105
  assert_true d.instance.send_keepalive_packet
@@ -104,7 +107,7 @@ class ForwardInputTest < Test::Unit::TestCase
104
107
 
105
108
  test 'both send_keepalive_packet and deny_keepalive cannot be enabled' do
106
109
  assert_raise(Fluent::ConfigError.new("both 'send_keepalive_packet' and 'deny_keepalive' cannot be set to true")) do
107
- create_driver(CONFIG_AUTH + %[
110
+ create_driver(config_auth + %[
108
111
  send_keepalive_packet true
109
112
  deny_keepalive true
110
113
  ])
@@ -173,7 +176,7 @@ class ForwardInputTest < Test::Unit::TestCase
173
176
  end
174
177
 
175
178
  test 'skip_invalid_event' do
176
- @d = d = create_driver(CONFIG + "skip_invalid_event true")
179
+ @d = d = create_driver(base_config + "skip_invalid_event true")
177
180
 
178
181
  time = event_time("2011-01-02 13:14:15 UTC")
179
182
 
@@ -243,20 +246,18 @@ class ForwardInputTest < Test::Unit::TestCase
243
246
 
244
247
  sub_test_case 'forward' do
245
248
  data(tcp: {
246
- config: CONFIG,
247
249
  options: {
248
250
  auth: false
249
251
  }
250
252
  },
251
253
  auth: {
252
- config: CONFIG_AUTH,
253
254
  options: {
254
255
  auth: true
255
256
  }
256
257
  })
257
258
  test 'plain' do |data|
258
- config = data[:config]
259
259
  options = data[:options]
260
+ config = options[:auth] ? config_auth : base_config
260
261
  @d = d = create_driver(config)
261
262
 
262
263
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -285,7 +286,7 @@ class ForwardInputTest < Test::Unit::TestCase
285
286
  result: "new_prefix.tag1"
286
287
  })
287
288
  test 'tag parameters' do |data|
288
- @d = create_driver(CONFIG + data[:param])
289
+ @d = create_driver(base_config + data[:param])
289
290
  time = event_time("2011-01-02 13:14:15 UTC")
290
291
  options = {auth: false}
291
292
 
@@ -305,20 +306,18 @@ class ForwardInputTest < Test::Unit::TestCase
305
306
  end
306
307
 
307
308
  data(tcp: {
308
- config: CONFIG,
309
309
  options: {
310
310
  auth: false
311
311
  }
312
312
  },
313
313
  auth: {
314
- config: CONFIG_AUTH,
315
314
  options: {
316
315
  auth: true
317
316
  }
318
317
  })
319
318
  test 'time_as_integer' do |data|
320
- config = data[:config]
321
319
  options = data[:options]
320
+ config = options[:auth] ? config_auth : base_config
322
321
  @d = d = create_driver(config)
323
322
 
324
323
  time_i = event_time("2011-01-02 13:14:15 UTC")
@@ -340,20 +339,18 @@ class ForwardInputTest < Test::Unit::TestCase
340
339
  end
341
340
 
342
341
  data(tcp: {
343
- config: CONFIG,
344
342
  options: {
345
343
  auth: false
346
344
  }
347
345
  },
348
346
  auth: {
349
- config: CONFIG_AUTH,
350
347
  options: {
351
348
  auth: true
352
349
  }
353
350
  })
354
351
  test 'skip_invalid_event' do |data|
355
- config = data[:config]
356
352
  options = data[:options]
353
+ config = options[:auth] ? config_auth : base_config
357
354
  @d = d = create_driver(config + "skip_invalid_event true")
358
355
 
359
356
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -380,20 +377,18 @@ class ForwardInputTest < Test::Unit::TestCase
380
377
 
381
378
  sub_test_case 'packed forward' do
382
379
  data(tcp: {
383
- config: CONFIG,
384
380
  options: {
385
381
  auth: false
386
382
  }
387
383
  },
388
384
  auth: {
389
- config: CONFIG_AUTH,
390
385
  options: {
391
386
  auth: true
392
387
  }
393
388
  })
394
389
  test 'plain' do |data|
395
- config = data[:config]
396
390
  options = data[:options]
391
+ config = options[:auth] ? config_auth : base_config
397
392
  @d = d = create_driver(config)
398
393
 
399
394
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -422,7 +417,7 @@ class ForwardInputTest < Test::Unit::TestCase
422
417
  result: "new_prefix.tag1"
423
418
  })
424
419
  test 'tag parameters' do |data|
425
- @d = create_driver(CONFIG + data[:param])
420
+ @d = create_driver(base_config + data[:param])
426
421
  time = event_time("2011-01-02 13:14:15 UTC")
427
422
  options = {auth: false}
428
423
 
@@ -442,20 +437,18 @@ class ForwardInputTest < Test::Unit::TestCase
442
437
  end
443
438
 
444
439
  data(tcp: {
445
- config: CONFIG,
446
440
  options: {
447
441
  auth: false
448
442
  }
449
443
  },
450
444
  auth: {
451
- config: CONFIG_AUTH,
452
445
  options: {
453
446
  auth: true
454
447
  }
455
448
  })
456
449
  test 'time_as_integer' do |data|
457
- config = data[:config]
458
450
  options = data[:options]
451
+ config = options[:auth] ? config_auth : base_config
459
452
  @d = d = create_driver(config)
460
453
 
461
454
  time_i = event_time("2011-01-02 13:14:15 UTC").to_i
@@ -476,20 +469,18 @@ class ForwardInputTest < Test::Unit::TestCase
476
469
  end
477
470
 
478
471
  data(tcp: {
479
- config: CONFIG,
480
472
  options: {
481
473
  auth: false
482
474
  }
483
475
  },
484
476
  auth: {
485
- config: CONFIG_AUTH,
486
477
  options: {
487
478
  auth: true
488
479
  }
489
480
  })
490
481
  test 'skip_invalid_event' do |data|
491
- config = data[:config]
492
482
  options = data[:options]
483
+ config = options[:auth] ? config_auth : base_config
493
484
  @d = d = create_driver(config + "skip_invalid_event true")
494
485
 
495
486
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -577,7 +568,7 @@ class ForwardInputTest < Test::Unit::TestCase
577
568
 
578
569
  sub_test_case 'warning' do
579
570
  test 'send_large_chunk_warning' do
580
- @d = d = create_driver(CONFIG + %[
571
+ @d = d = create_driver(base_config + %[
581
572
  chunk_size_warn_limit 16M
582
573
  chunk_size_limit 32M
583
574
  ])
@@ -613,7 +604,7 @@ class ForwardInputTest < Test::Unit::TestCase
613
604
  end
614
605
 
615
606
  test 'send_large_chunk_only_warning' do
616
- @d = d = create_driver(CONFIG + %[
607
+ @d = d = create_driver(base_config + %[
617
608
  chunk_size_warn_limit 16M
618
609
  ])
619
610
  time = event_time("2014-04-25 13:14:15 UTC")
@@ -639,7 +630,7 @@ class ForwardInputTest < Test::Unit::TestCase
639
630
  end
640
631
 
641
632
  test 'send_large_chunk_limit' do
642
- @d = d = create_driver(CONFIG + %[
633
+ @d = d = create_driver(base_config + %[
643
634
  chunk_size_warn_limit 16M
644
635
  chunk_size_limit 32M
645
636
  ])
@@ -697,20 +688,18 @@ class ForwardInputTest < Test::Unit::TestCase
697
688
 
698
689
  sub_test_case 'respond to required ack' do
699
690
  data(tcp: {
700
- config: CONFIG,
701
691
  options: {
702
692
  auth: false
703
693
  }
704
694
  },
705
695
  auth: {
706
- config: CONFIG_AUTH,
707
696
  options: {
708
697
  auth: true
709
698
  }
710
699
  })
711
700
  test 'message' do |data|
712
- config = data[:config]
713
701
  options = data[:options]
702
+ config = options[:auth] ? config_auth : base_config
714
703
  @d = d = create_driver(config)
715
704
 
716
705
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -736,20 +725,18 @@ class ForwardInputTest < Test::Unit::TestCase
736
725
 
737
726
  # FIX: response is not pushed into @responses because IO.select has been blocked until InputForward shutdowns
738
727
  data(tcp: {
739
- config: CONFIG,
740
728
  options: {
741
729
  auth: false
742
730
  }
743
731
  },
744
732
  auth: {
745
- config: CONFIG_AUTH,
746
733
  options: {
747
734
  auth: true
748
735
  }
749
736
  })
750
737
  test 'forward' do |data|
751
- config = data[:config]
752
738
  options = data[:options]
739
+ config = options[:auth] ? config_auth : base_config
753
740
  @d = d = create_driver(config)
754
741
 
755
742
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -776,20 +763,18 @@ class ForwardInputTest < Test::Unit::TestCase
776
763
  end
777
764
 
778
765
  data(tcp: {
779
- config: CONFIG,
780
766
  options: {
781
767
  auth: false
782
768
  }
783
769
  },
784
770
  auth: {
785
- config: CONFIG_AUTH,
786
771
  options: {
787
772
  auth: true
788
773
  }
789
774
  })
790
775
  test 'packed_forward' do |data|
791
- config = data[:config]
792
776
  options = data[:options]
777
+ config = options[:auth] ? config_auth : base_config
793
778
  @d = d = create_driver(config)
794
779
 
795
780
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -817,22 +802,20 @@ class ForwardInputTest < Test::Unit::TestCase
817
802
 
818
803
  data(
819
804
  tcp: {
820
- config: CONFIG,
821
805
  options: {
822
806
  auth: false
823
807
  }
824
808
  },
825
809
  ### Auth is not supported with json
826
810
  # auth: {
827
- # config: CONFIG_AUTH,
828
811
  # options: {
829
812
  # auth: true
830
813
  # }
831
814
  # },
832
815
  )
833
816
  test 'message_json' do |data|
834
- config = data[:config]
835
817
  options = data[:options]
818
+ config = options[:auth] ? config_auth : base_config
836
819
  @d = d = create_driver(config)
837
820
 
838
821
  time_i = event_time("2011-01-02 13:14:15 UTC")
@@ -859,20 +842,18 @@ class ForwardInputTest < Test::Unit::TestCase
859
842
 
860
843
  sub_test_case 'not respond without required ack' do
861
844
  data(tcp: {
862
- config: CONFIG,
863
845
  options: {
864
846
  auth: false
865
847
  }
866
848
  },
867
849
  auth: {
868
- config: CONFIG_AUTH,
869
850
  options: {
870
851
  auth: true
871
852
  }
872
853
  })
873
854
  test 'message' do |data|
874
- config = data[:config]
875
855
  options = data[:options]
856
+ config = options[:auth] ? config_auth : base_config
876
857
  @d = d = create_driver(config)
877
858
 
878
859
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -893,20 +874,18 @@ class ForwardInputTest < Test::Unit::TestCase
893
874
  end
894
875
 
895
876
  data(tcp: {
896
- config: CONFIG,
897
877
  options: {
898
878
  auth: false
899
879
  }
900
880
  },
901
881
  auth: {
902
- config: CONFIG_AUTH,
903
882
  options: {
904
883
  auth: true
905
884
  }
906
885
  })
907
886
  test 'forward' do |data|
908
- config = data[:config]
909
887
  options = data[:options]
888
+ config = options[:auth] ? config_auth : base_config
910
889
  @d = d = create_driver(config)
911
890
 
912
891
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -929,20 +908,18 @@ class ForwardInputTest < Test::Unit::TestCase
929
908
  end
930
909
 
931
910
  data(tcp: {
932
- config: CONFIG,
933
911
  options: {
934
912
  auth: false
935
913
  }
936
914
  },
937
915
  auth: {
938
- config: CONFIG_AUTH,
939
916
  options: {
940
917
  auth: true
941
918
  }
942
919
  })
943
920
  test 'packed_forward' do |data|
944
- config = data[:config]
945
921
  options = data[:options]
922
+ config = options[:auth] ? config_auth : base_config
946
923
  @d = d = create_driver(config)
947
924
 
948
925
  time = event_time("2011-01-02 13:14:15 UTC")
@@ -966,22 +943,21 @@ class ForwardInputTest < Test::Unit::TestCase
966
943
 
967
944
  data(
968
945
  tcp: {
969
- config: CONFIG,
970
946
  options: {
971
947
  auth: false
972
948
  }
973
949
  },
974
950
  ### Auth is not supported with json
975
951
  # auth: {
976
- # config: CONFIG_AUTH,
952
+ # config: config_auth,
977
953
  # options: {
978
954
  # auth: true
979
955
  # }
980
956
  # },
981
957
  )
982
958
  test 'message_json' do |data|
983
- config = data[:config]
984
959
  options = data[:options]
960
+ config = options[:auth] ? config_auth : base_config
985
961
  @d = d = create_driver(config)
986
962
 
987
963
  time_i = event_time("2011-01-02 13:14:15 UTC").to_i
@@ -1096,7 +1072,7 @@ class ForwardInputTest < Test::Unit::TestCase
1096
1072
  end
1097
1073
 
1098
1074
  def connect
1099
- TCPSocket.new('127.0.0.1', PORT)
1075
+ TCPSocket.new('127.0.0.1', @port)
1100
1076
  end
1101
1077
 
1102
1078
  # Data ordering is not assured:
@@ -1165,7 +1141,7 @@ class ForwardInputTest < Test::Unit::TestCase
1165
1141
  end
1166
1142
 
1167
1143
  def execute_test_with_source_hostname_key(*keys, &block)
1168
- conf = CONFIG.dup
1144
+ conf = base_config.dup
1169
1145
  if keys.include?(:hostname)
1170
1146
  conf << <<EOL
1171
1147
  source_hostname_key source_hostname