fluentd 1.7.1 → 1.7.3
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/CHANGELOG.md +35 -4
- data/lib/fluent/plugin/buf_file.rb +1 -1
- data/lib/fluent/plugin/buf_file_single.rb +1 -1
- data/lib/fluent/plugin/in_syslog.rb +10 -6
- data/lib/fluent/plugin/in_tcp.rb +62 -0
- data/lib/fluent/plugin/multi_output.rb +1 -1
- data/lib/fluent/plugin/out_forward/socket_cache.rb +3 -1
- data/lib/fluent/plugin/output.rb +3 -0
- data/lib/fluent/plugin_helper/formatter.rb +1 -1
- data/lib/fluent/plugin_helper/parser.rb +1 -1
- data/lib/fluent/plugin_helper/storage.rb +1 -1
- data/lib/fluent/root_agent.rb +4 -4
- data/lib/fluent/system_config.rb +2 -2
- data/lib/fluent/version.rb +1 -1
- data/test/plugin/out_forward/test_socket_cache.rb +11 -1
- data/test/plugin/test_buffer_file_chunk.rb +1 -1
- data/test/plugin/test_in_syslog.rb +9 -5
- data/test/plugin/test_in_tcp.rb +40 -0
- data/test/plugin/test_output.rb +17 -0
- data/test/plugin/test_output_as_buffered.rb +1 -1
- data/test/test_root_agent.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 027c04b3446f864debe4b57849a0c30a2f3c24aac96f69e629d437a265ffafde
|
4
|
+
data.tar.gz: '0996f7d53774c1fc151b589b12570baf39f59b9edb39e761a40ea40f37908189'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bf68902c8b6947a65956451d3601856d95f147428f3e3fc9b5f6a746ac15c02eaecb79a191c7811b605ca462310fac5849ce80167f37d1148c86f4f7e5598de4
|
7
|
+
data.tar.gz: 2c35f820be92a1e3741472c227c5fc8532aa06ef208001db981dd527d2bfa45c30d53888a4326e175e7db460980ade85a2f6b16bde6511940887d0786fdd9ad1
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,36 @@
|
|
1
1
|
# v1.7
|
2
2
|
|
3
|
+
## Release v1.7.3 - 2019/10/01
|
4
|
+
|
5
|
+
### Enhancement
|
6
|
+
|
7
|
+
* in_syslog: Replace priority_key with severity_key
|
8
|
+
https://github.com/fluent/fluentd/pull/2636
|
9
|
+
|
10
|
+
### Bug fixes
|
11
|
+
|
12
|
+
* out_forward: Fix nil error after purge obsoleted sockets in socket cache
|
13
|
+
https://github.com/fluent/fluentd/pull/2635
|
14
|
+
* fix typo in ChangeLog
|
15
|
+
https://github.com/fluent/fluentd/pull/2633
|
16
|
+
|
17
|
+
## Release v1.7.2 - 2019/09/19
|
18
|
+
|
19
|
+
### Enhancement
|
20
|
+
|
21
|
+
* in_tcp: Add security/client to restrict access
|
22
|
+
https://github.com/fluent/fluentd/pull/2622
|
23
|
+
|
24
|
+
### Bug fixes
|
25
|
+
|
26
|
+
* buf_file/buf_file_single: fix to handle compress data during restart
|
27
|
+
https://github.com/fluent/fluentd/pull/2620
|
28
|
+
* plugin: Use `__send__` to avoid conflict with user defined `send`
|
29
|
+
https://github.com/fluent/fluentd/pull/2614
|
30
|
+
* buffer: reject invalid timekey at configure phase
|
31
|
+
https://github.com/fluent/fluentd/pull/2615
|
32
|
+
|
33
|
+
|
3
34
|
## Release v1.7.1 - 2019/09/08
|
4
35
|
|
5
36
|
### Enhancement
|
@@ -19,7 +50,7 @@
|
|
19
50
|
https://github.com/fluent/fluentd/pull/2598
|
20
51
|
* buf_file_single: fix duplicated path setting check
|
21
52
|
https://github.com/fluent/fluentd/pull/2600
|
22
|
-
* fix msgpack-ruby
|
53
|
+
* fix msgpack-ruby dependency to use recent feature
|
23
54
|
https://github.com/fluent/fluentd/pull/2606
|
24
55
|
|
25
56
|
|
@@ -623,7 +654,7 @@
|
|
623
654
|
|
624
655
|
## Release v1.0.0 - 2017/12/6
|
625
656
|
|
626
|
-
See [CNCF
|
657
|
+
See [CNCF announcement](https://www.cncf.io/blog/2017/12/06/fluentd-v1-0/) :)
|
627
658
|
|
628
659
|
### New features / Enhancements
|
629
660
|
|
@@ -893,7 +924,7 @@ See [CNCF announcment](https://www.cncf.io/blog/2017/12/06/fluentd-v1-0/) :)
|
|
893
924
|
https://github.com/fluent/fluentd/pull/1492
|
894
925
|
* parser: Allow escape sequence in Apache access log
|
895
926
|
https://github.com/fluent/fluentd/pull/1479
|
896
|
-
* config: Add actual value in the
|
927
|
+
* config: Add actual value in the placeholder error message
|
897
928
|
https://github.com/fluent/fluentd/pull/1497
|
898
929
|
* log: Add Fluent::Log#<< to support some SDKs
|
899
930
|
https://github.com/fluent/fluentd/pull/1478
|
@@ -1210,7 +1241,7 @@ See [CNCF announcment](https://www.cncf.io/blog/2017/12/06/fluentd-v1-0/) :)
|
|
1210
1241
|
https://github.com/fluent/fluentd/pull/1067
|
1211
1242
|
* filter_record_transformer: Fix to prevent overwriting reserved placeholder keys
|
1212
1243
|
https://github.com/fluent/fluentd/pull/1176
|
1213
|
-
* Migrate some
|
1244
|
+
* Migrate some built-in plugins into v0.14 API
|
1214
1245
|
https://github.com/fluent/fluentd/pull/1149
|
1215
1246
|
https://github.com/fluent/fluentd/pull/1151
|
1216
1247
|
* Update dependencies
|
@@ -146,7 +146,7 @@ module Fluent
|
|
146
146
|
end
|
147
147
|
|
148
148
|
begin
|
149
|
-
chunk = Fluent::Plugin::Buffer::FileChunk.new(m, path, mode) # file chunk resumes contents of metadata
|
149
|
+
chunk = Fluent::Plugin::Buffer::FileChunk.new(m, path, mode, compress: @compress) # file chunk resumes contents of metadata
|
150
150
|
rescue Fluent::Plugin::Buffer::FileChunk::FileChunkError => e
|
151
151
|
handle_broken_files(path, mode, e)
|
152
152
|
next
|
@@ -167,7 +167,7 @@ module Fluent
|
|
167
167
|
end
|
168
168
|
|
169
169
|
begin
|
170
|
-
chunk = Fluent::Plugin::Buffer::FileSingleChunk.new(m, path, mode, @key_in_path)
|
170
|
+
chunk = Fluent::Plugin::Buffer::FileSingleChunk.new(m, path, mode, @key_in_path, compress: @compress)
|
171
171
|
chunk.restore_size(@chunk_format) if @calc_num_records
|
172
172
|
rescue Fluent::Plugin::Buffer::FileSingleChunk::FileChunkError => e
|
173
173
|
handle_broken_files(path, mode, e)
|
@@ -56,7 +56,7 @@ module Fluent::Plugin
|
|
56
56
|
23 => 'local7'
|
57
57
|
}
|
58
58
|
|
59
|
-
|
59
|
+
SEVERITY_MAP = {
|
60
60
|
0 => 'emerg',
|
61
61
|
1 => 'alert',
|
62
62
|
2 => 'crit',
|
@@ -91,8 +91,8 @@ module Fluent::Plugin
|
|
91
91
|
config_param :resolve_hostname, :bool, default: nil
|
92
92
|
desc 'The field name of source address of sender.'
|
93
93
|
config_param :source_address_key, :string, default: nil
|
94
|
-
desc 'The field name of the
|
95
|
-
config_param :
|
94
|
+
desc 'The field name of the severity.'
|
95
|
+
config_param :severity_key, :string, default: nil, alias: :priority_key
|
96
96
|
desc 'The field name of the facility.'
|
97
97
|
config_param :facility_key, :string, default: nil
|
98
98
|
|
@@ -119,6 +119,10 @@ module Fluent::Plugin
|
|
119
119
|
|
120
120
|
super
|
121
121
|
|
122
|
+
if conf.has_key?('priority_key')
|
123
|
+
log.warn "priority_key is deprecated. Use severity_key instead"
|
124
|
+
end
|
125
|
+
|
122
126
|
@use_default = false
|
123
127
|
|
124
128
|
@parser = parser_create
|
@@ -233,14 +237,14 @@ module Fluent::Plugin
|
|
233
237
|
|
234
238
|
pri ||= record.delete('pri')
|
235
239
|
facility = FACILITY_MAP[pri >> 3]
|
236
|
-
|
240
|
+
severity = SEVERITY_MAP[pri & 0b111]
|
237
241
|
|
238
|
-
record[@
|
242
|
+
record[@severity_key] = severity if @severity_key
|
239
243
|
record[@facility_key] = facility if @facility_key
|
240
244
|
record[@source_address_key] = sock.remote_addr if @source_address_key
|
241
245
|
record[@source_hostname_key] = sock.remote_host if @source_hostname_key
|
242
246
|
|
243
|
-
tag = "#{@tag}.#{facility}.#{
|
247
|
+
tag = "#{@tag}.#{facility}.#{severity}"
|
244
248
|
emit(tag, time, record)
|
245
249
|
end
|
246
250
|
rescue => e
|
data/lib/fluent/plugin/in_tcp.rb
CHANGED
@@ -41,6 +41,16 @@ module Fluent::Plugin
|
|
41
41
|
desc 'The payload is read up to this character.'
|
42
42
|
config_param :delimiter, :string, default: "\n" # syslog family add "\n" to each message and this seems only way to split messages in tcp stream
|
43
43
|
|
44
|
+
# in_forward like host/network restriction
|
45
|
+
config_section :security, required: false, multi: false do
|
46
|
+
config_section :client, param_name: :clients, required: true, multi: true do
|
47
|
+
desc 'The IP address or host name of the client'
|
48
|
+
config_param :host, :string, default: nil
|
49
|
+
desc 'Network address specification'
|
50
|
+
config_param :network, :string, default: nil
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
44
54
|
def configure(conf)
|
45
55
|
compat_parameters_convert(conf, :parser)
|
46
56
|
parser_config = conf.elements('parse').first
|
@@ -51,6 +61,33 @@ module Fluent::Plugin
|
|
51
61
|
@_event_loop_blocking_timeout = @blocking_timeout
|
52
62
|
@source_hostname_key ||= @source_host_key if @source_host_key
|
53
63
|
|
64
|
+
@nodes = nil
|
65
|
+
if @security
|
66
|
+
@nodes = []
|
67
|
+
@security.clients.each do |client|
|
68
|
+
if client.host && client.network
|
69
|
+
raise Fluent::ConfigError, "both of 'host' and 'network' are specified for client"
|
70
|
+
end
|
71
|
+
if !client.host && !client.network
|
72
|
+
raise Fluent::ConfigError, "Either of 'host' and 'network' must be specified for client"
|
73
|
+
end
|
74
|
+
source = nil
|
75
|
+
if client.host
|
76
|
+
begin
|
77
|
+
source = IPSocket.getaddress(client.host)
|
78
|
+
rescue SocketError
|
79
|
+
raise Fluent::ConfigError, "host '#{client.host}' cannot be resolved"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
source_addr = begin
|
83
|
+
IPAddr.new(source || client.network)
|
84
|
+
rescue ArgumentError
|
85
|
+
raise Fluent::ConfigError, "network '#{client.network}' address format is invalid"
|
86
|
+
end
|
87
|
+
@nodes.push(source_addr)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
54
91
|
@parser = parser_create(conf: parser_config)
|
55
92
|
end
|
56
93
|
|
@@ -64,6 +101,11 @@ module Fluent::Plugin
|
|
64
101
|
del_size = @delimiter.length
|
65
102
|
if @_extract_enabled && @_extract_tag_key
|
66
103
|
server_create(:in_tcp_server_single_emit, @port, bind: @bind, resolve_name: !!@source_hostname_key) do |data, conn|
|
104
|
+
unless check_client(conn)
|
105
|
+
conn.close
|
106
|
+
next
|
107
|
+
end
|
108
|
+
|
67
109
|
conn.buffer << data
|
68
110
|
buf = conn.buffer
|
69
111
|
pos = 0
|
@@ -89,6 +131,11 @@ module Fluent::Plugin
|
|
89
131
|
end
|
90
132
|
else
|
91
133
|
server_create(:in_tcp_server_batch_emit, @port, bind: @bind, resolve_name: !!@source_hostname_key) do |data, conn|
|
134
|
+
unless check_client(conn)
|
135
|
+
conn.close
|
136
|
+
next
|
137
|
+
end
|
138
|
+
|
92
139
|
conn.buffer << data
|
93
140
|
buf = conn.buffer
|
94
141
|
pos = 0
|
@@ -114,5 +161,20 @@ module Fluent::Plugin
|
|
114
161
|
end
|
115
162
|
end
|
116
163
|
end
|
164
|
+
|
165
|
+
private
|
166
|
+
|
167
|
+
def check_client(conn)
|
168
|
+
if @nodes
|
169
|
+
remote_addr = conn.remote_addr
|
170
|
+
node = @nodes.find { |n| n.include?(remote_addr) rescue false }
|
171
|
+
unless node
|
172
|
+
log.warn "anonymous client '#{remote_addr}' denied"
|
173
|
+
return false
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
true
|
178
|
+
end
|
117
179
|
end
|
118
180
|
end
|
@@ -94,7 +94,7 @@ module Fluent
|
|
94
94
|
@outputs.each do |o|
|
95
95
|
begin
|
96
96
|
log.debug "calling #{method_name} on output plugin dynamically created", type: Fluent::Plugin.lookup_type_from_class(o.class), plugin_id: o.plugin_id
|
97
|
-
o.
|
97
|
+
o.__send__(method_name) unless o.__send__(checker_name)
|
98
98
|
rescue Exception => e
|
99
99
|
log.warn "unexpected error while calling #{method_name} on output plugin dynamically created", plugin: o.class, plugin_id: o.plugin_id, error: e
|
100
100
|
log.warn_backtrace
|
@@ -81,7 +81,9 @@ module Fluent::Plugin
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
|
+
# reuse same object (@available_sockets)
|
86
|
+
@available_sockets.reject! { |_, v| v.empty? }
|
85
87
|
|
86
88
|
sockets += @inactive_sockets
|
87
89
|
@inactive_sockets.clear
|
data/lib/fluent/plugin/output.rb
CHANGED
@@ -310,6 +310,9 @@ module Fluent
|
|
310
310
|
Fluent::Timezone.validate!(@buffer_config.timekey_zone)
|
311
311
|
@timekey_zone = @buffer_config.timekey_use_utc ? '+0000' : @buffer_config.timekey_zone
|
312
312
|
@timekey = @buffer_config.timekey
|
313
|
+
if @timekey <= 0
|
314
|
+
raise Fluent::ConfigError, "timekey should be greater than 0. current timekey: #{@timekey}"
|
315
|
+
end
|
313
316
|
@timekey_use_utc = @buffer_config.timekey_use_utc
|
314
317
|
@offset = Fluent::Timezone.utc_offset(@timekey_zone)
|
315
318
|
@calculate_offset = @offset.respond_to?(:call) ? @offset : nil
|
@@ -103,7 +103,7 @@ module Fluent
|
|
103
103
|
def formatter_operate(method_name, &block)
|
104
104
|
@_formatters.each_pair do |usage, formatter|
|
105
105
|
begin
|
106
|
-
formatter.
|
106
|
+
formatter.__send__(method_name)
|
107
107
|
block.call(formatter) if block_given?
|
108
108
|
rescue => e
|
109
109
|
log.error "unexpected error while #{method_name}", usage: usage, formatter: formatter, error: e
|
@@ -103,7 +103,7 @@ module Fluent
|
|
103
103
|
def parser_operate(method_name, &block)
|
104
104
|
@_parsers.each_pair do |usage, parser|
|
105
105
|
begin
|
106
|
-
parser.
|
106
|
+
parser.__send__(method_name)
|
107
107
|
block.call(parser) if block_given?
|
108
108
|
rescue => e
|
109
109
|
log.error "unexpected error while #{method_name}", usage: usage, parser: parser, error: e
|
@@ -138,7 +138,7 @@ module Fluent
|
|
138
138
|
@_storages.each_pair do |usage, s|
|
139
139
|
begin
|
140
140
|
block.call(s) if block_given?
|
141
|
-
s.storage.
|
141
|
+
s.storage.__send__(method_name)
|
142
142
|
rescue => e
|
143
143
|
log.error "unexpected error while #{method_name}", usage: usage, storage: s.storage, error: e
|
144
144
|
end
|
data/lib/fluent/root_agent.rb
CHANGED
@@ -240,7 +240,7 @@ module Fluent
|
|
240
240
|
lifecycle do |instance, kind|
|
241
241
|
begin
|
242
242
|
log.debug "calling #{method} on #{kind} plugin", type: Plugin.lookup_type_from_class(instance.class), plugin_id: instance.plugin_id
|
243
|
-
instance.
|
243
|
+
instance.__send__(method) unless instance.__send__(checker)
|
244
244
|
rescue Exception => e
|
245
245
|
log.warn "unexpected error while calling #{method} on #{kind} plugin", plugin: instance.class, plugin_id: instance.plugin_id, error: e
|
246
246
|
log.warn_backtrace
|
@@ -270,17 +270,17 @@ module Fluent
|
|
270
270
|
operation = "preparing shutdown" # for logging
|
271
271
|
log.debug "#{operation} #{kind} plugin", type: Plugin.lookup_type_from_class(instance.class), plugin_id: instance.plugin_id
|
272
272
|
begin
|
273
|
-
instance.
|
273
|
+
instance.__send__(:before_shutdown) unless instance.__send__(:before_shutdown?)
|
274
274
|
rescue Exception => e
|
275
275
|
log.warn "unexpected error while #{operation} on #{kind} plugin", plugin: instance.class, plugin_id: instance.plugin_id, error: e
|
276
276
|
log.warn_backtrace
|
277
277
|
end
|
278
278
|
operation = "shutting down"
|
279
279
|
log.info "#{operation} #{kind} plugin", type: Plugin.lookup_type_from_class(instance.class), plugin_id: instance.plugin_id
|
280
|
-
instance.
|
280
|
+
instance.__send__(:shutdown) unless instance.__send__(:shutdown?)
|
281
281
|
else
|
282
282
|
log.debug "#{operation} #{kind} plugin", type: Plugin.lookup_type_from_class(instance.class), plugin_id: instance.plugin_id
|
283
|
-
instance.
|
283
|
+
instance.__send__(method) unless instance.__send__(checker)
|
284
284
|
end
|
285
285
|
rescue Exception => e
|
286
286
|
log.warn "unexpected error while #{operation} on #{kind} plugin", plugin: instance.class, plugin_id: instance.plugin_id, error: e
|
data/lib/fluent/system_config.rb
CHANGED
@@ -136,7 +136,7 @@ module Fluent
|
|
136
136
|
supervisor_value = instance_variable_get("@#{param}")
|
137
137
|
next if supervisor_value.nil? # it's not configured by command line options
|
138
138
|
|
139
|
-
system.
|
139
|
+
system.__send__("#{param}=", supervisor_value)
|
140
140
|
end
|
141
141
|
end
|
142
142
|
}
|
@@ -179,7 +179,7 @@ module Fluent
|
|
179
179
|
@_system_config = (defined?($_system_config) && $_system_config ? $_system_config : Fluent::Engine.system_config).dup
|
180
180
|
end
|
181
181
|
opts.each_pair do |key, value|
|
182
|
-
@_system_config.
|
182
|
+
@_system_config.__send__(:"#{key.to_s}=", value)
|
183
183
|
end
|
184
184
|
end
|
185
185
|
end
|
data/lib/fluent/version.rb
CHANGED
@@ -5,7 +5,7 @@ require 'timecop'
|
|
5
5
|
|
6
6
|
class SocketCacheTest < Test::Unit::TestCase
|
7
7
|
sub_test_case 'checkout_or' do
|
8
|
-
test 'when
|
8
|
+
test 'when given key does not exist' do
|
9
9
|
c = Fluent::Plugin::ForwardOutput::SocketCache.new(10, $log)
|
10
10
|
sock = mock!.open { 'socket' }.subject
|
11
11
|
assert_equal('socket', c.checkout_or('key') { sock.open })
|
@@ -38,6 +38,16 @@ class SocketCacheTest < Test::Unit::TestCase
|
|
38
38
|
sock = mock!.open { new_sock }.subject
|
39
39
|
assert_equal(new_sock, c.checkout_or('key') { sock.open })
|
40
40
|
end
|
41
|
+
|
42
|
+
test 'reuse same hash object after calling purge_obsolete_socks' do
|
43
|
+
c = Fluent::Plugin::ForwardOutput::SocketCache.new(10, $log)
|
44
|
+
c.checkout_or('key') { 'socket' }
|
45
|
+
c.purge_obsolete_socks
|
46
|
+
|
47
|
+
assert_nothing_raised(NoMethodError) do
|
48
|
+
c.checkout_or('key') { 'new socket' }
|
49
|
+
end
|
50
|
+
end
|
41
51
|
end
|
42
52
|
|
43
53
|
sub_test_case 'checkin' do
|
@@ -495,7 +495,7 @@ class BufferFileChunkTest < Test::Unit::TestCase
|
|
495
495
|
end
|
496
496
|
end
|
497
497
|
|
498
|
-
test 'ensure to remove metadata file if #write_metadata raise an error
|
498
|
+
test 'ensure to remove metadata file if #write_metadata raise an error because of disk full' do
|
499
499
|
chunk_path = File.join(@chunkdir, 'test.*.log')
|
500
500
|
stub(Fluent::UniqueId).hex(anything) { 'id' } # to fix chunk id
|
501
501
|
|
@@ -217,11 +217,15 @@ EOS
|
|
217
217
|
compare_test_result(d.events, tests, {host: host})
|
218
218
|
end
|
219
219
|
|
220
|
-
|
221
|
-
|
220
|
+
data(
|
221
|
+
severity_key: 'severity_key',
|
222
|
+
priority_key: 'priority_key',
|
223
|
+
)
|
224
|
+
def test_msg_size_with_severity_key(param_name)
|
225
|
+
d = create_driver([CONFIG, "#{param_name} severity"].join("\n"))
|
222
226
|
tests = create_test_case
|
223
227
|
|
224
|
-
|
228
|
+
severity = 'info'
|
225
229
|
d.run(expect_emits: 2) do
|
226
230
|
u = UDPSocket.new
|
227
231
|
u.connect('127.0.0.1', PORT)
|
@@ -231,7 +235,7 @@ EOS
|
|
231
235
|
end
|
232
236
|
|
233
237
|
assert(d.events.size > 0)
|
234
|
-
compare_test_result(d.events, tests, {
|
238
|
+
compare_test_result(d.events, tests, {severity: severity})
|
235
239
|
end
|
236
240
|
|
237
241
|
def test_msg_size_with_facility_key
|
@@ -311,7 +315,7 @@ EOS
|
|
311
315
|
assert_equal(options[:host], events[i][2]['source_host']) if options[:host]
|
312
316
|
assert_equal(options[:address], events[i][2]['source_address']) if options[:address]
|
313
317
|
assert_equal(options[:hostname], events[i][2]['source_hostname']) if options[:hostname]
|
314
|
-
assert_equal(options[:
|
318
|
+
assert_equal(options[:severity], events[i][2]['severity']) if options[:severity]
|
315
319
|
assert_equal(options[:facility], events[i][2]['facility']) if options[:facility]
|
316
320
|
}
|
317
321
|
end
|
data/test/plugin/test_in_tcp.rb
CHANGED
@@ -163,6 +163,46 @@ class TcpInputTest < Test::Unit::TestCase
|
|
163
163
|
assert_equal address, event[2]['addr']
|
164
164
|
end
|
165
165
|
|
166
|
+
sub_test_case '<security>' do
|
167
|
+
test 'accept from allowed client' do
|
168
|
+
d = create_driver(CONFIG + %!
|
169
|
+
<security>
|
170
|
+
<client>
|
171
|
+
network 127.0.0.1
|
172
|
+
</client>
|
173
|
+
</security>
|
174
|
+
!)
|
175
|
+
d.run(expect_records: 1) do
|
176
|
+
create_tcp_socket('127.0.0.1', PORT) do |sock|
|
177
|
+
sock.send("hello\n", 0)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
assert_equal 1, d.events.size
|
182
|
+
event = d.events[0]
|
183
|
+
assert_equal 'tcp', event[0]
|
184
|
+
assert_equal 'hello', event[2]['message']
|
185
|
+
end
|
186
|
+
|
187
|
+
test 'deny from disallowed client' do
|
188
|
+
d = create_driver(CONFIG + %!
|
189
|
+
<security>
|
190
|
+
<client>
|
191
|
+
network 200.0.0.0
|
192
|
+
</client>
|
193
|
+
</security>
|
194
|
+
!)
|
195
|
+
d.run(shutdown: false, expect_records: 1, timeout: 2) do
|
196
|
+
create_tcp_socket('127.0.0.1', PORT) do |sock|
|
197
|
+
sock.send("hello\n", 0)
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
assert_equal 1, d.instance.log.logs.count { |l| l =~ /anonymous client/ }
|
202
|
+
assert_equal 0, d.events.size
|
203
|
+
end
|
204
|
+
end
|
205
|
+
|
166
206
|
sub_test_case '<extract>' do
|
167
207
|
test 'extract tag from record field' do
|
168
208
|
d = create_driver(BASE_CONFIG + %!
|
data/test/plugin/test_output.rb
CHANGED
@@ -868,6 +868,23 @@ class OutputTest < Test::Unit::TestCase
|
|
868
868
|
end
|
869
869
|
end
|
870
870
|
|
871
|
+
test 'raises an error if timekey is less than equal 0' do
|
872
|
+
i = create_output(:delayed)
|
873
|
+
assert_raise Fluent::ConfigError.new('timekey should be greater than 0. current timekey: 0.0') do
|
874
|
+
i.configure(config_element('ROOT','',{},[config_element('buffer', 'time', { "timekey" => nil })]))
|
875
|
+
end
|
876
|
+
|
877
|
+
i = create_output(:delayed)
|
878
|
+
assert_raise Fluent::ConfigError.new('timekey should be greater than 0. current timekey: 0.0') do
|
879
|
+
i.configure(config_element('ROOT','',{},[config_element('buffer', 'time', { "timekey" => 0 })]))
|
880
|
+
end
|
881
|
+
|
882
|
+
i = create_output(:delayed)
|
883
|
+
assert_raise Fluent::ConfigError.new('timekey should be greater than 0. current timekey: -1.0') do
|
884
|
+
i.configure(config_element('ROOT','',{},[config_element('buffer', 'time', { "timekey" => -1 })]))
|
885
|
+
end
|
886
|
+
end
|
887
|
+
|
871
888
|
sub_test_case 'sync output feature' do
|
872
889
|
setup do
|
873
890
|
@i = create_output(:sync)
|
@@ -1112,7 +1112,7 @@ class BufferedOutputTest < Test::Unit::TestCase
|
|
1112
1112
|
assert_equal(0, @i.write_count)
|
1113
1113
|
|
1114
1114
|
Timecop.freeze(Time.parse('2019-02-09 00:00:12 +0900'))
|
1115
|
-
#
|
1115
|
+
# write should be called in few seconds since
|
1116
1116
|
# running interval of enque thread is timekey_wait / 11.0.
|
1117
1117
|
waiting(5){ sleep 0.1 until @i.write_count == 1 }
|
1118
1118
|
end
|
data/test/test_root_agent.rb
CHANGED
@@ -710,7 +710,7 @@ EOC
|
|
710
710
|
end
|
711
711
|
end
|
712
712
|
|
713
|
-
test 'raises configuration error for worker id collisions on multi workers syntax when multi
|
713
|
+
test 'raises configuration error for worker id collisions on multi workers syntax when multi available worker_ids are left' do
|
714
714
|
errmsg = "specified worker_id<1> collisions is detected on <worker> directive. Available worker id(s): [2, 3]"
|
715
715
|
assert_raise Fluent::ConfigError.new(errmsg) do
|
716
716
|
conf = <<-EOC
|
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.7.
|
4
|
+
version: 1.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|