fluentd 1.13.3 → 1.14.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.
- checksums.yaml +4 -4
- data/.drone.yml +6 -6
- data/.github/ISSUE_TEMPLATE/bug_report.yaml +1 -0
- data/.github/workflows/windows-test.yaml +3 -3
- data/CHANGELOG.md +96 -0
- data/fluentd.gemspec +1 -1
- data/lib/fluent/command/cat.rb +13 -3
- data/lib/fluent/command/fluentd.rb +8 -0
- data/lib/fluent/compat/output.rb +9 -6
- data/lib/fluent/config/parser.rb +1 -1
- data/lib/fluent/config/v1_parser.rb +1 -1
- data/lib/fluent/event_router.rb +28 -1
- data/lib/fluent/plugin/bare_output.rb +49 -8
- data/lib/fluent/plugin/buf_file.rb +2 -2
- data/lib/fluent/plugin/buffer.rb +84 -22
- data/lib/fluent/plugin/filter.rb +35 -1
- data/lib/fluent/plugin/in_http.rb +21 -2
- data/lib/fluent/plugin/in_monitor_agent.rb +4 -2
- data/lib/fluent/plugin/in_syslog.rb +13 -1
- data/lib/fluent/plugin/in_tail/position_file.rb +1 -1
- data/lib/fluent/plugin/in_tail.rb +37 -5
- data/lib/fluent/plugin/input.rb +39 -1
- data/lib/fluent/plugin/metrics.rb +119 -0
- data/lib/fluent/plugin/metrics_local.rb +96 -0
- data/lib/fluent/plugin/multi_output.rb +43 -6
- data/lib/fluent/plugin/out_copy.rb +1 -1
- data/lib/fluent/plugin/out_forward.rb +15 -7
- data/lib/fluent/plugin/output.rb +80 -38
- data/lib/fluent/plugin/parser_apache2.rb +1 -1
- data/lib/fluent/plugin/storage_local.rb +3 -5
- data/lib/fluent/plugin.rb +10 -1
- data/lib/fluent/plugin_helper/event_emitter.rb +8 -1
- data/lib/fluent/plugin_helper/metrics.rb +129 -0
- data/lib/fluent/plugin_helper/server.rb +4 -2
- data/lib/fluent/plugin_helper.rb +1 -0
- data/lib/fluent/plugin_id.rb +2 -1
- data/lib/fluent/root_agent.rb +6 -0
- data/lib/fluent/supervisor.rb +4 -2
- data/lib/fluent/system_config.rb +9 -1
- data/lib/fluent/time.rb +21 -20
- data/lib/fluent/version.rb +1 -1
- data/test/command/test_cat.rb +31 -2
- data/test/config/test_system_config.rb +6 -0
- data/test/plugin/in_tail/test_io_handler.rb +12 -4
- data/test/plugin/in_tail/test_position_file.rb +26 -4
- data/test/plugin/test_bare_output.rb +13 -0
- data/test/plugin/test_buffer.rb +8 -2
- data/test/plugin/test_filter.rb +11 -0
- data/test/plugin/test_in_http.rb +40 -0
- data/test/plugin/test_in_monitor_agent.rb +214 -8
- data/test/plugin/test_in_syslog.rb +35 -0
- data/test/plugin/test_in_tail.rb +28 -29
- data/test/plugin/test_input.rb +11 -0
- data/test/plugin/test_metrics.rb +294 -0
- data/test/plugin/test_metrics_local.rb +96 -0
- data/test/plugin/test_multi_output.rb +25 -1
- data/test/plugin/test_output.rb +16 -0
- data/test/plugin_helper/test_event_emitter.rb +29 -0
- data/test/plugin_helper/test_metrics.rb +137 -0
- data/test/test_plugin_classes.rb +102 -0
- data/test/test_root_agent.rb +30 -1
- data/test/test_time_parser.rb +22 -0
- metadata +13 -4
data/test/test_plugin_classes.rb
CHANGED
@@ -5,11 +5,78 @@ require 'fluent/plugin/bare_output'
|
|
5
5
|
require 'fluent/plugin/filter'
|
6
6
|
|
7
7
|
module FluentTest
|
8
|
+
class FluentTestCounterMetrics < Fluent::Plugin::Metrics
|
9
|
+
Fluent::Plugin.register_metrics('test_counter', self)
|
10
|
+
|
11
|
+
attr_reader :data
|
12
|
+
|
13
|
+
def initialize
|
14
|
+
super
|
15
|
+
@data = 0
|
16
|
+
end
|
17
|
+
def get
|
18
|
+
@data
|
19
|
+
end
|
20
|
+
def inc
|
21
|
+
@data +=1
|
22
|
+
end
|
23
|
+
def add(value)
|
24
|
+
@data += value
|
25
|
+
end
|
26
|
+
def set(value)
|
27
|
+
@data = value
|
28
|
+
end
|
29
|
+
def close
|
30
|
+
@data = 0
|
31
|
+
super
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
class FluentTestGaugeMetrics < Fluent::Plugin::Metrics
|
36
|
+
Fluent::Plugin.register_metrics('test_gauge', self)
|
37
|
+
|
38
|
+
attr_reader :data
|
39
|
+
|
40
|
+
def initialize
|
41
|
+
super
|
42
|
+
@data = 0
|
43
|
+
end
|
44
|
+
def get
|
45
|
+
@data
|
46
|
+
end
|
47
|
+
def inc
|
48
|
+
@data += 1
|
49
|
+
end
|
50
|
+
def dec
|
51
|
+
@data -=1
|
52
|
+
end
|
53
|
+
def add(value)
|
54
|
+
@data += value
|
55
|
+
end
|
56
|
+
def sub(value)
|
57
|
+
@data -= value
|
58
|
+
end
|
59
|
+
def set(value)
|
60
|
+
@data = value
|
61
|
+
end
|
62
|
+
def close
|
63
|
+
@data = 0
|
64
|
+
super
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
8
68
|
class FluentTestInput < ::Fluent::Plugin::Input
|
9
69
|
::Fluent::Plugin.register_input('test_in', self)
|
10
70
|
|
11
71
|
attr_reader :started
|
12
72
|
|
73
|
+
def initialize
|
74
|
+
super
|
75
|
+
# stub metrics instances
|
76
|
+
@emit_records_metrics = FluentTest::FluentTestCounterMetrics.new
|
77
|
+
@emit_size_metrics = FluentTest::FluentTestCounterMetrics.new
|
78
|
+
end
|
79
|
+
|
13
80
|
def start
|
14
81
|
super
|
15
82
|
@started = true
|
@@ -28,6 +95,13 @@ module FluentTest
|
|
28
95
|
|
29
96
|
config_param :num, :integer, default: 10000
|
30
97
|
|
98
|
+
def initialize
|
99
|
+
super
|
100
|
+
# stub metrics instances
|
101
|
+
@emit_records_metrics = FluentTest::FluentTestCounterMetrics.new
|
102
|
+
@emit_size_metrics = FluentTest::FluentTestCounterMetrics.new
|
103
|
+
end
|
104
|
+
|
31
105
|
def start
|
32
106
|
super
|
33
107
|
@started = true
|
@@ -49,6 +123,15 @@ module FluentTest
|
|
49
123
|
def initialize
|
50
124
|
super
|
51
125
|
@events = Hash.new { |h, k| h[k] = [] }
|
126
|
+
# stub metrics instances
|
127
|
+
@num_errors_metrics = FluentTest::FluentTestCounterMetrics.new
|
128
|
+
@emit_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
129
|
+
@emit_records_metrics = FluentTest::FluentTestCounterMetrics.new
|
130
|
+
@emit_size_metrics = FluentTest::FluentTestCounterMetrics.new
|
131
|
+
@write_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
132
|
+
@rollback_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
133
|
+
@flush_time_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
134
|
+
@slow_flush_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
52
135
|
end
|
53
136
|
|
54
137
|
attr_reader :events
|
@@ -168,6 +251,19 @@ module FluentTest
|
|
168
251
|
class FluentTestErrorOutput < ::Fluent::Plugin::Output
|
169
252
|
::Fluent::Plugin.register_output('test_out_error', self)
|
170
253
|
|
254
|
+
def initialize
|
255
|
+
super
|
256
|
+
# stub metrics instances
|
257
|
+
@num_errors_metrics = FluentTest::FluentTestCounterMetrics.new
|
258
|
+
@emit_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
259
|
+
@emit_records_metrics = FluentTest::FluentTestCounterMetrics.new
|
260
|
+
@emit_size_metrics = FluentTest::FluentTestCounterMetrics.new
|
261
|
+
@write_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
262
|
+
@rollback_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
263
|
+
@flush_time_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
264
|
+
@slow_flush_count_metrics = FluentTest::FluentTestCounterMetrics.new
|
265
|
+
end
|
266
|
+
|
171
267
|
def format(tag, time, record)
|
172
268
|
raise "emit error!"
|
173
269
|
end
|
@@ -184,6 +280,9 @@ module FluentTest
|
|
184
280
|
super()
|
185
281
|
@num = 0
|
186
282
|
@field = field
|
283
|
+
# stub metrics instances
|
284
|
+
@emit_records_metrics = FluentTest::FluentTestCounterMetrics.new
|
285
|
+
@emit_size_metrics = FluentTest::FluentTestCounterMetrics.new
|
187
286
|
end
|
188
287
|
|
189
288
|
attr_reader :num
|
@@ -213,6 +312,9 @@ module FluentTest
|
|
213
312
|
super()
|
214
313
|
@num = 0
|
215
314
|
@field = field
|
315
|
+
# stub metrics instances
|
316
|
+
@emit_records_metrics = FluentTest::FluentTestCounterMetrics.new
|
317
|
+
@emit_size_metrics = FluentTest::FluentTestCounterMetrics.new
|
216
318
|
end
|
217
319
|
|
218
320
|
attr_reader :num
|
data/test/test_root_agent.rb
CHANGED
@@ -16,7 +16,8 @@ class RootAgentTest < ::Test::Unit::TestCase
|
|
16
16
|
|
17
17
|
data(
|
18
18
|
'suppress interval' => [{'emit_error_log_interval' => 30}, {:@suppress_emit_error_log_interval => 30}],
|
19
|
-
'without source' => [{'without_source' => true}, {:@without_source => true}]
|
19
|
+
'without source' => [{'without_source' => true}, {:@without_source => true}],
|
20
|
+
'enable input metrics' => [{'enable_input_metrics' => true}, {:@enable_input_metrics => true}],
|
20
21
|
)
|
21
22
|
def test_initialize_with_opt(data)
|
22
23
|
opt, expected = data
|
@@ -109,6 +110,34 @@ EOC
|
|
109
110
|
end
|
110
111
|
end
|
111
112
|
|
113
|
+
test 'raises configuration error for label without name' do
|
114
|
+
conf = <<-EOC
|
115
|
+
<label>
|
116
|
+
@type test_out
|
117
|
+
</label>
|
118
|
+
EOC
|
119
|
+
errmsg = "Missing symbol argument on <label> directive"
|
120
|
+
assert_raise Fluent::ConfigError.new(errmsg) do
|
121
|
+
configure_ra(conf)
|
122
|
+
end
|
123
|
+
end
|
124
|
+
|
125
|
+
test 'raises configuration error for <label @ROOT>' do
|
126
|
+
conf = <<-EOC
|
127
|
+
<source>
|
128
|
+
@type test_in
|
129
|
+
@label @ROOT
|
130
|
+
</source>
|
131
|
+
<label @ROOT>
|
132
|
+
@type test_out
|
133
|
+
</label>
|
134
|
+
EOC
|
135
|
+
errmsg = "@ROOT for <label> is not permitted, reserved for getting root router"
|
136
|
+
assert_raise Fluent::ConfigError.new(errmsg) do
|
137
|
+
configure_ra(conf)
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
112
141
|
test 'raises configuration error if there are not match sections in label section' do
|
113
142
|
conf = <<-EOC
|
114
143
|
<source>
|
data/test/test_time_parser.rb
CHANGED
@@ -337,4 +337,26 @@ class TimeParserTest < ::Test::Unit::TestCase
|
|
337
337
|
assert_equal_event_time(time, parser.parse('2021-01-01T12:00:00+0900'))
|
338
338
|
end
|
339
339
|
end
|
340
|
+
|
341
|
+
# https://github.com/fluent/fluentd/issues/3195
|
342
|
+
test 'change timezone without zone specifier in a format' do
|
343
|
+
expected = 1607457600 # 2020-12-08T20:00:00Z
|
344
|
+
time1 = time2 = nil
|
345
|
+
|
346
|
+
with_timezone("UTC-05") do # EST
|
347
|
+
i = DummyForTimeParser.new
|
348
|
+
i.configure(config_element('parse', '', {'time_type' => 'string',
|
349
|
+
'time_format' => '%Y-%m-%dT%H:%M:%SZ',
|
350
|
+
'utc' => true}))
|
351
|
+
parser = i.time_parser_create
|
352
|
+
|
353
|
+
time1 = parser.parse('2020-12-08T20:00:00Z').to_i
|
354
|
+
time2 = with_timezone("UTC-04") do # EDT
|
355
|
+
# to avoid using cache, increment 1 sec
|
356
|
+
parser.parse('2020-12-08T20:00:01Z').to_i
|
357
|
+
end
|
358
|
+
end
|
359
|
+
|
360
|
+
assert_equal([expected, expected + 1], [time1, time2])
|
361
|
+
end
|
340
362
|
end
|
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.
|
4
|
+
version: 1.14.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -172,7 +172,7 @@ dependencies:
|
|
172
172
|
requirements:
|
173
173
|
- - ">="
|
174
174
|
- !ruby/object:Gem::Version
|
175
|
-
version: 0.2.
|
175
|
+
version: 0.2.4
|
176
176
|
- - "<"
|
177
177
|
- !ruby/object:Gem::Version
|
178
178
|
version: 1.0.0
|
@@ -182,7 +182,7 @@ dependencies:
|
|
182
182
|
requirements:
|
183
183
|
- - ">="
|
184
184
|
- !ruby/object:Gem::Version
|
185
|
-
version: 0.2.
|
185
|
+
version: 0.2.4
|
186
186
|
- - "<"
|
187
187
|
- !ruby/object:Gem::Version
|
188
188
|
version: 1.0.0
|
@@ -569,6 +569,8 @@ files:
|
|
569
569
|
- lib/fluent/plugin/in_udp.rb
|
570
570
|
- lib/fluent/plugin/in_unix.rb
|
571
571
|
- lib/fluent/plugin/input.rb
|
572
|
+
- lib/fluent/plugin/metrics.rb
|
573
|
+
- lib/fluent/plugin/metrics_local.rb
|
572
574
|
- lib/fluent/plugin/multi_output.rb
|
573
575
|
- lib/fluent/plugin/out_copy.rb
|
574
576
|
- lib/fluent/plugin/out_exec.rb
|
@@ -633,6 +635,7 @@ files:
|
|
633
635
|
- lib/fluent/plugin_helper/http_server/server.rb
|
634
636
|
- lib/fluent/plugin_helper/http_server/ssl_context_builder.rb
|
635
637
|
- lib/fluent/plugin_helper/inject.rb
|
638
|
+
- lib/fluent/plugin_helper/metrics.rb
|
636
639
|
- lib/fluent/plugin_helper/parser.rb
|
637
640
|
- lib/fluent/plugin_helper/record_accessor.rb
|
638
641
|
- lib/fluent/plugin_helper/retry_state.rb
|
@@ -794,6 +797,8 @@ files:
|
|
794
797
|
- test/plugin/test_in_unix.rb
|
795
798
|
- test/plugin/test_input.rb
|
796
799
|
- test/plugin/test_metadata.rb
|
800
|
+
- test/plugin/test_metrics.rb
|
801
|
+
- test/plugin/test_metrics_local.rb
|
797
802
|
- test/plugin/test_multi_output.rb
|
798
803
|
- test/plugin/test_out_copy.rb
|
799
804
|
- test/plugin/test_out_exec.rb
|
@@ -869,6 +874,7 @@ files:
|
|
869
874
|
- test/plugin_helper/test_formatter.rb
|
870
875
|
- test/plugin_helper/test_http_server_helper.rb
|
871
876
|
- test/plugin_helper/test_inject.rb
|
877
|
+
- test/plugin_helper/test_metrics.rb
|
872
878
|
- test/plugin_helper/test_parser.rb
|
873
879
|
- test/plugin_helper/test_record_accessor.rb
|
874
880
|
- test/plugin_helper/test_retry_state.rb
|
@@ -1034,6 +1040,8 @@ test_files:
|
|
1034
1040
|
- test/plugin/test_in_unix.rb
|
1035
1041
|
- test/plugin/test_input.rb
|
1036
1042
|
- test/plugin/test_metadata.rb
|
1043
|
+
- test/plugin/test_metrics.rb
|
1044
|
+
- test/plugin/test_metrics_local.rb
|
1037
1045
|
- test/plugin/test_multi_output.rb
|
1038
1046
|
- test/plugin/test_out_copy.rb
|
1039
1047
|
- test/plugin/test_out_exec.rb
|
@@ -1109,6 +1117,7 @@ test_files:
|
|
1109
1117
|
- test/plugin_helper/test_formatter.rb
|
1110
1118
|
- test/plugin_helper/test_http_server_helper.rb
|
1111
1119
|
- test/plugin_helper/test_inject.rb
|
1120
|
+
- test/plugin_helper/test_metrics.rb
|
1112
1121
|
- test/plugin_helper/test_parser.rb
|
1113
1122
|
- test/plugin_helper/test_record_accessor.rb
|
1114
1123
|
- test/plugin_helper/test_retry_state.rb
|