fluentd 0.14.17 → 0.14.18
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 +18 -0
- data/README.md +5 -1
- data/lib/fluent/plugin/in_tail.rb +1 -1
- data/lib/fluent/plugin/out_forward.rb +4 -2
- data/lib/fluent/plugin/parser_syslog.rb +4 -3
- data/lib/fluent/supervisor.rb +3 -2
- data/lib/fluent/version.rb +1 -1
- data/templates/new_gem/README.md.erb +1 -1
- data/test/plugin/test_parser_syslog.rb +53 -4
- data/test/test_supervisor.rb +79 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c1133959101a3b085e0bcc08fbf62a87d2768a3
|
4
|
+
data.tar.gz: 4f8d96e61d587a5c89d2f3c73a6e1d0ba0e4fecc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1985d37f5b9b9dffd4b40af81112768653a71afe1249be0d36c4a57f2ef768d1f9e3e5007ffe3df85246bc745bf6a8bf1e4ba2d161fa391c0fa87da8b24a46f7
|
7
|
+
data.tar.gz: fe02e6749d04169de7b79eb2c5c6dadbe1f223acbc72d3b2415e1ad2a48b6a9b9d6bb0ea36b06d41b623c7486149fdc4e5df6f0a125f6b0cf936c53cd69439ef
|
data/ChangeLog
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# v0.14
|
2
2
|
|
3
|
+
## Release v0.14.18 - 2017/06/21
|
4
|
+
|
5
|
+
### New features / Enhancements
|
6
|
+
|
7
|
+
* parser: Add rfc5424 regex without priority
|
8
|
+
https://github.com/fluent/fluentd/pull/1600
|
9
|
+
|
10
|
+
### Bug fixes
|
11
|
+
|
12
|
+
* in_tail: Fix timing issue that the excluded_path doesn't apply.
|
13
|
+
https://github.com/fluent/fluentd/pull/1597
|
14
|
+
* config: Fix broken UTF-8 encoded configuration file handling
|
15
|
+
https://github.com/fluent/fluentd/pull/1592
|
16
|
+
* out_forward: Don't stop heartbeat when error happen
|
17
|
+
https://github.com/fluent/fluentd/pull/1602
|
18
|
+
* Fix command name typo in plugin template
|
19
|
+
https://github.com/fluent/fluentd/pull/1603
|
20
|
+
|
3
21
|
## Release v0.14.17 - 2017/05/29
|
4
22
|
|
5
23
|
### New features / Enhancements
|
data/README.md
CHANGED
@@ -51,6 +51,11 @@ You can run specified test via `TEST` environment variable:
|
|
51
51
|
$ bundle exec rake test TEST=test/test_specified_path.rb
|
52
52
|
$ bundle exec rake test TEST=test/test_*.rb
|
53
53
|
|
54
|
+
## Running in Production
|
55
|
+
|
56
|
+
Many enterprises run Fluentd in production to handle all of their logging needs. For enterprises requiring Security tested binaries, SLA-based support, architectural guidance, and enhanced plugin connectors see [Fluentd Enterprise](https://www.fluentd.org/enterprise).
|
57
|
+
|
58
|
+
|
54
59
|
## Fluentd UI: Admin GUI
|
55
60
|
|
56
61
|
[Fluentd UI](https://github.com/fluent/fluentd-ui) is a graphical user interface to start/stop/configure Fluentd.
|
@@ -68,7 +73,6 @@ You can run specified test via `TEST` environment variable:
|
|
68
73
|
- Author: Sadayuki Furuhashi
|
69
74
|
- Copyright: (c) 2011 FURUHASHI Sadayuki
|
70
75
|
- License: Apache License, Version 2.0
|
71
|
-
|
72
76
|
## Contributors:
|
73
77
|
|
74
78
|
Patches contributed by [great developers](https://github.com/fluent/fluentd/contributors).
|
@@ -187,7 +187,6 @@ module Fluent::Plugin
|
|
187
187
|
date = Time.now
|
188
188
|
paths = []
|
189
189
|
|
190
|
-
excluded = @exclude_path.map { |path| path = date.strftime(path); path.include?('*') ? Dir.glob(path) : path }.flatten.uniq
|
191
190
|
@paths.each { |path|
|
192
191
|
path = date.strftime(path)
|
193
192
|
if path.include?('*')
|
@@ -214,6 +213,7 @@ module Fluent::Plugin
|
|
214
213
|
paths << path
|
215
214
|
end
|
216
215
|
}
|
216
|
+
excluded = @exclude_path.map { |path| path = date.strftime(path); path.include?('*') ? Dir.glob(path) : path }.flatten.uniq
|
217
217
|
paths - excluded
|
218
218
|
end
|
219
219
|
|
@@ -402,8 +402,10 @@ module Fluent::Plugin
|
|
402
402
|
log.trace "sending heartbeat", host: n.host, port: n.port, heartbeat_type: @heartbeat_type
|
403
403
|
n.usock = @usock if @usock
|
404
404
|
n.send_heartbeat
|
405
|
-
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR, Errno::ECONNREFUSED
|
406
|
-
log.debug "failed to send heartbeat packet", host: n.host, port: n.port, heartbeat_type: @heartbeat_type, error:
|
405
|
+
rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR, Errno::ECONNREFUSED, Errno::ETIMEDOUT => e
|
406
|
+
log.debug "failed to send heartbeat packet", host: n.host, port: n.port, heartbeat_type: @heartbeat_type, error: e
|
407
|
+
rescue => e
|
408
|
+
log.debug "unexpected error happen during heartbeat", host: n.host, port: n.port, heartbeat_type: @heartbeat_type, error: e
|
407
409
|
end
|
408
410
|
}
|
409
411
|
end
|
@@ -27,7 +27,8 @@ module Fluent
|
|
27
27
|
REGEXP = /^(?<time>[^ ]*\s*[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$/
|
28
28
|
# From in_syslog default pattern
|
29
29
|
REGEXP_WITH_PRI = /^\<(?<pri>[0-9]+)\>(?<time>[^ ]* {1,2}[^ ]* [^ ]*) (?<host>[^ ]*) (?<ident>[a-zA-Z0-9_\/\.\-]*)(?:\[(?<pid>[0-9]+)\])?(?:[^\:]*\:)? *(?<message>.*)$/
|
30
|
-
REGEXP_RFC5424 = /\A
|
30
|
+
REGEXP_RFC5424 = /\A^(?<time>[^ ]+) (?<host>[^ ]+) (?<ident>[^ ]+) (?<pid>[-0-9]+) (?<msgid>[^ ]+) (?<extradata>(\[(.*)\]|[^ ])) (?<message>.+)$\z/
|
31
|
+
REGEXP_RFC5424_WITH_PRI = /\A^\<(?<pri>[0-9]{1,3})\>[1-9]\d{0,2} (?<time>[^ ]+) (?<host>[^ ]+) (?<ident>[^ ]+) (?<pid>[-0-9]+) (?<msgid>[^ ]+) (?<extradata>(\[(.*)\]|[^ ])) (?<message>.+)$\z/
|
31
32
|
REGEXP_DETECT_RFC5424 = /^\<.*\>[1-9]\d{0,2}/
|
32
33
|
|
33
34
|
config_set_default :time_format, "%b %d %H:%M:%S"
|
@@ -55,7 +56,7 @@ module Fluent
|
|
55
56
|
alias_method :parse, :parse_plain
|
56
57
|
end
|
57
58
|
@time_format = @rfc5424_time_format unless conf.has_key?('time_format')
|
58
|
-
REGEXP_RFC5424
|
59
|
+
@with_priority ? REGEXP_RFC5424_WITH_PRI : REGEXP_RFC5424
|
59
60
|
when :auto
|
60
61
|
class << self
|
61
62
|
alias_method :parse, :parse_auto
|
@@ -77,7 +78,7 @@ module Fluent
|
|
77
78
|
|
78
79
|
def parse_auto(text, &block)
|
79
80
|
if REGEXP_DETECT_RFC5424.match(text)
|
80
|
-
@regexp = REGEXP_RFC5424
|
81
|
+
@regexp = @with_priority ? REGEXP_RFC5424_WITH_PRI : REGEXP_RFC5424
|
81
82
|
@time_parser = @time_parser_rfc5424
|
82
83
|
else
|
83
84
|
@regexp = @with_priority ? REGEXP_WITH_PRI : REGEXP
|
data/lib/fluent/supervisor.rb
CHANGED
@@ -218,7 +218,8 @@ module Fluent
|
|
218
218
|
|
219
219
|
config_fname = File.basename(path)
|
220
220
|
config_basedir = File.dirname(path)
|
221
|
-
|
221
|
+
# Assume fluent.conf encoding is UTF-8
|
222
|
+
config_data = File.open(path, "r:utf-8:utf-8") {|f| f.read }
|
222
223
|
inline_config = params['inline_config']
|
223
224
|
if inline_config == '-'
|
224
225
|
config_data << "\n" << STDIN.read
|
@@ -717,7 +718,7 @@ module Fluent
|
|
717
718
|
$log.info :supervisor, "reading config file", path: @config_path
|
718
719
|
@config_fname = File.basename(@config_path)
|
719
720
|
@config_basedir = File.dirname(@config_path)
|
720
|
-
@config_data = File.
|
721
|
+
@config_data = File.open(@config_path, "r:utf-8:utf-8") {|f| f.read }
|
721
722
|
if @inline_config == '-'
|
722
723
|
@config_data << "\n" << STDIN.read
|
723
724
|
elsif @inline_config
|
data/lib/fluent/version.rb
CHANGED
@@ -69,6 +69,7 @@ class SyslogParserTest < ::Test::Unit::TestCase
|
|
69
69
|
@parser.configure(
|
70
70
|
'time_format' => '%Y-%m-%dT%H:%M:%S.%L%z',
|
71
71
|
'message_format' => 'rfc5424',
|
72
|
+
'with_priority' => true,
|
72
73
|
)
|
73
74
|
text = '<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd - - - Hi, from Fluentd!'
|
74
75
|
@parser.instance.parse(text) do |time, record|
|
@@ -78,11 +79,31 @@ class SyslogParserTest < ::Test::Unit::TestCase
|
|
78
79
|
assert_equal "-", record["extradata"]
|
79
80
|
assert_equal "Hi, from Fluentd!", record["message"]
|
80
81
|
end
|
82
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_RFC5424_WITH_PRI,
|
83
|
+
@parser.instance.patterns['format'])
|
84
|
+
end
|
85
|
+
|
86
|
+
def test_parse_with_rfc5424_message_and_without_priority
|
87
|
+
@parser.configure(
|
88
|
+
'time_format' => '%Y-%m-%dT%H:%M:%S.%L%z',
|
89
|
+
'message_format' => 'rfc5424',
|
90
|
+
)
|
91
|
+
text = '2017-02-06T13:14:15.003Z 192.168.0.1 fluentd - - - Hi, from Fluentd!'
|
92
|
+
@parser.instance.parse(text) do |time, record|
|
93
|
+
assert_equal(event_time("2017-02-06T13:14:15.003Z", format: '%Y-%m-%dT%H:%M:%S.%L%z'), time)
|
94
|
+
assert_equal "-", record["pid"]
|
95
|
+
assert_equal "-", record["msgid"]
|
96
|
+
assert_equal "-", record["extradata"]
|
97
|
+
assert_equal "Hi, from Fluentd!", record["message"]
|
98
|
+
end
|
99
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_RFC5424,
|
100
|
+
@parser.instance.patterns['format'])
|
81
101
|
end
|
82
102
|
|
83
103
|
def test_parse_with_rfc5424_message_without_time_format
|
84
104
|
@parser.configure(
|
85
105
|
'message_format' => 'rfc5424',
|
106
|
+
'with_priority' => true,
|
86
107
|
)
|
87
108
|
text = '<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd - - - Hi, from Fluentd!'
|
88
109
|
@parser.instance.parse(text) do |time, record|
|
@@ -98,6 +119,7 @@ class SyslogParserTest < ::Test::Unit::TestCase
|
|
98
119
|
@parser.configure(
|
99
120
|
'time_format' => '%Y-%m-%dT%H:%M:%S.%L%z',
|
100
121
|
'message_format' => 'rfc5424',
|
122
|
+
'with_priority' => true,
|
101
123
|
)
|
102
124
|
text = '<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd 11111 ID24224 [exampleSDID@20224 iut="3" eventSource="Application" eventID="11211"] Hi, from Fluentd!'
|
103
125
|
@parser.instance.parse(text) do |time, record|
|
@@ -122,6 +144,7 @@ assert_equal "11111", record["pid"]
|
|
122
144
|
assert_equal(event_time("Feb 28 00:00:12", format: '%b %d %M:%S:%H'), time)
|
123
145
|
assert_equal(@expected, record)
|
124
146
|
end
|
147
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP, @parser.instance.patterns['format'])
|
125
148
|
end
|
126
149
|
|
127
150
|
def test_auto_with_legacy_syslog_priority_message
|
@@ -135,12 +158,14 @@ assert_equal "11111", record["pid"]
|
|
135
158
|
assert_equal(event_time("Feb 28 12:00:00", format: '%b %d %M:%S:%H'), time)
|
136
159
|
assert_equal(@expected.merge('pri' => 6), record)
|
137
160
|
end
|
161
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_WITH_PRI, @parser.instance.patterns['format'])
|
138
162
|
end
|
139
163
|
|
140
164
|
def test_parse_with_rfc5424_message
|
141
165
|
@parser.configure(
|
142
166
|
'time_format' => '%Y-%m-%dT%H:%M:%S.%L%z',
|
143
167
|
'message_format' => 'auto',
|
168
|
+
'with_priority' => true,
|
144
169
|
)
|
145
170
|
text = '<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd - - - Hi, from Fluentd!'
|
146
171
|
@parser.instance.parse(text) do |time, record|
|
@@ -150,12 +175,15 @@ assert_equal "11111", record["pid"]
|
|
150
175
|
assert_equal "-", record["extradata"]
|
151
176
|
assert_equal "Hi, from Fluentd!", record["message"]
|
152
177
|
end
|
178
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_RFC5424_WITH_PRI,
|
179
|
+
@parser.instance.patterns['format'])
|
153
180
|
end
|
154
181
|
|
155
182
|
def test_parse_with_rfc5424_structured_message
|
156
183
|
@parser.configure(
|
157
184
|
'time_format' => '%Y-%m-%dT%H:%M:%S.%L%z',
|
158
185
|
'message_format' => 'auto',
|
186
|
+
'with_priority' => true,
|
159
187
|
)
|
160
188
|
text = '<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd 11111 ID24224 [exampleSDID@20224 iut="3" eventSource="Application" eventID="11211"] Hi, from Fluentd!'
|
161
189
|
@parser.instance.parse(text) do |time, record|
|
@@ -166,6 +194,8 @@ assert_equal "11111", record["pid"]
|
|
166
194
|
record["extradata"]
|
167
195
|
assert_equal "Hi, from Fluentd!", record["message"]
|
168
196
|
end
|
197
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_RFC5424_WITH_PRI,
|
198
|
+
@parser.instance.patterns['format'])
|
169
199
|
end
|
170
200
|
|
171
201
|
def test_parse_with_both_message_type
|
@@ -173,12 +203,15 @@ assert_equal "11111", record["pid"]
|
|
173
203
|
'time_format' => '%b %d %M:%S:%H',
|
174
204
|
'rfc5424_time_format' => '%Y-%m-%dT%H:%M:%S.%L%z',
|
175
205
|
'message_format' => 'auto',
|
206
|
+
'with_priority' => true,
|
176
207
|
)
|
177
|
-
text = 'Feb 28 12:00:00 192.168.0.1 fluentd[11111]: [error] Syslog test'
|
208
|
+
text = '<1>Feb 28 12:00:00 192.168.0.1 fluentd[11111]: [error] Syslog test'
|
178
209
|
@parser.instance.parse(text) do |time, record|
|
179
210
|
assert_equal(event_time("Feb 28 12:00:00", format: '%b %d %M:%S:%H'), time)
|
180
|
-
assert_equal(@expected, record)
|
211
|
+
assert_equal(@expected.merge('pri' => 1), record)
|
181
212
|
end
|
213
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_WITH_PRI, @parser.instance.patterns['format'])
|
214
|
+
|
182
215
|
text = '<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd 11111 ID24224 [exampleSDID@20224 iut="3" eventSource="Application" eventID="11211"] Hi, from Fluentd!'
|
183
216
|
@parser.instance.parse(text) do |time, record|
|
184
217
|
assert_equal(event_time("2017-02-06T13:14:15.003Z", format: '%Y-%m-%dT%H:%M:%S.%L%z'), time)
|
@@ -188,11 +221,16 @@ assert_equal "11111", record["pid"]
|
|
188
221
|
record["extradata"]
|
189
222
|
assert_equal "Hi, from Fluentd!", record["message"]
|
190
223
|
end
|
191
|
-
|
224
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_RFC5424_WITH_PRI,
|
225
|
+
@parser.instance.patterns['format'])
|
226
|
+
|
227
|
+
text = '<1>Feb 28 12:00:02 192.168.0.1 fluentd[11111]: [error] Syslog test'
|
192
228
|
@parser.instance.parse(text) do |time, record|
|
193
229
|
assert_equal(event_time("Feb 28 12:00:02", format: '%b %d %M:%S:%H'), time)
|
194
|
-
assert_equal(@expected, record)
|
230
|
+
assert_equal(@expected.merge('pri' => 1), record)
|
195
231
|
end
|
232
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_WITH_PRI, @parser.instance.patterns['format'])
|
233
|
+
|
196
234
|
text = '<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd - - - Hi, from Fluentd!'
|
197
235
|
@parser.instance.parse(text) do |time, record|
|
198
236
|
assert_equal(event_time("2017-02-06T13:14:15.003Z", format: '%Y-%m-%dT%H:%M:%S.%L%z'), time)
|
@@ -201,6 +239,8 @@ assert_equal "11111", record["pid"]
|
|
201
239
|
assert_equal "-", record["extradata"]
|
202
240
|
assert_equal "Hi, from Fluentd!", record["message"]
|
203
241
|
end
|
242
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_RFC5424_WITH_PRI,
|
243
|
+
@parser.instance.patterns['format'])
|
204
244
|
end
|
205
245
|
|
206
246
|
def test_parse_with_both_message_type_and_priority
|
@@ -215,6 +255,8 @@ assert_equal "11111", record["pid"]
|
|
215
255
|
assert_equal(event_time("Feb 28 12:00:00", format: '%b %d %M:%S:%H'), time)
|
216
256
|
assert_equal(@expected.merge('pri' => 6), record)
|
217
257
|
end
|
258
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_WITH_PRI, @parser.instance.patterns['format'])
|
259
|
+
|
218
260
|
text = '<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd 11111 ID24224 [exampleSDID@20224 iut="3" eventSource="Application" eventID="11211"] Hi, from Fluentd!'
|
219
261
|
@parser.instance.parse(text) do |time, record|
|
220
262
|
assert_equal(event_time("2017-02-06T13:14:15.003Z", format: '%Y-%m-%dT%H:%M:%S.%L%z'), time)
|
@@ -224,11 +266,16 @@ assert_equal "11111", record["pid"]
|
|
224
266
|
record["extradata"]
|
225
267
|
assert_equal "Hi, from Fluentd!", record["message"]
|
226
268
|
end
|
269
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_RFC5424_WITH_PRI,
|
270
|
+
@parser.instance.patterns['format'])
|
271
|
+
|
227
272
|
text = '<16>Feb 28 12:00:02 192.168.0.1 fluentd[11111]: [error] Syslog test'
|
228
273
|
@parser.instance.parse(text) do |time, record|
|
229
274
|
assert_equal(event_time("Feb 28 12:00:02", format: '%b %d %M:%S:%H'), time)
|
230
275
|
assert_equal(@expected.merge('pri' => 16), record)
|
231
276
|
end
|
277
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_WITH_PRI, @parser.instance.patterns['format'])
|
278
|
+
|
232
279
|
text = '<16>1 2017-02-06T13:14:15.003Z 192.168.0.1 fluentd - - - Hi, from Fluentd!'
|
233
280
|
@parser.instance.parse(text) do |time, record|
|
234
281
|
assert_equal(event_time("2017-02-06T13:14:15.003Z", format: '%Y-%m-%dT%H:%M:%S.%L%z'), time)
|
@@ -237,6 +284,8 @@ assert_equal "11111", record["pid"]
|
|
237
284
|
assert_equal "-", record["extradata"]
|
238
285
|
assert_equal "Hi, from Fluentd!", record["message"]
|
239
286
|
end
|
287
|
+
assert_equal(Fluent::Plugin::SyslogParser::REGEXP_RFC5424_WITH_PRI,
|
288
|
+
@parser.instance.patterns['format'])
|
240
289
|
end
|
241
290
|
end
|
242
291
|
end
|
data/test/test_supervisor.rb
CHANGED
@@ -77,6 +77,46 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
77
77
|
$log.out.reset
|
78
78
|
end
|
79
79
|
|
80
|
+
def test_read_config_with_multibyte_string
|
81
|
+
tmp_path = "#{TMP_DIR}/dir/test_multibyte_config.conf"
|
82
|
+
conf_str = %[
|
83
|
+
<source>
|
84
|
+
@type forward
|
85
|
+
@id forward_input
|
86
|
+
@label @INPUT
|
87
|
+
</source>
|
88
|
+
<label @INPUT>
|
89
|
+
<filter>
|
90
|
+
@type record_transformer
|
91
|
+
<record>
|
92
|
+
message こんにちは. ${record["name"]} has made a order of ${record["item"]} just now.
|
93
|
+
</record>
|
94
|
+
</filter>
|
95
|
+
<match>
|
96
|
+
@type stdout
|
97
|
+
</match>
|
98
|
+
</label>
|
99
|
+
]
|
100
|
+
FileUtils.mkdir_p(File.dirname(tmp_path))
|
101
|
+
File.open(tmp_path, "w:utf-8") {|file| file.write(conf_str) }
|
102
|
+
|
103
|
+
opts = Fluent::Supervisor.default_options
|
104
|
+
sv = Fluent::Supervisor.new(opts)
|
105
|
+
|
106
|
+
use_v1_config = {}
|
107
|
+
use_v1_config['use_v1_config'] = true
|
108
|
+
|
109
|
+
sv.instance_variable_set(:@config_path, tmp_path)
|
110
|
+
sv.instance_variable_set(:@use_v1_config, use_v1_config)
|
111
|
+
sv.send(:read_config)
|
112
|
+
|
113
|
+
conf = sv.instance_variable_get(:@conf)
|
114
|
+
label = conf.elements.detect {|e| e.name == "label" }
|
115
|
+
filter = label.elements.detect {|e| e.name == "filter" }
|
116
|
+
record_transformer = filter.elements.detect {|e| e.name = "record_transformer" }
|
117
|
+
assert_equal(Encoding::UTF_8, record_transformer["message"].encoding)
|
118
|
+
end
|
119
|
+
|
80
120
|
def test_system_config
|
81
121
|
opts = Fluent::Supervisor.default_options
|
82
122
|
sv = Fluent::Supervisor.new(opts)
|
@@ -319,6 +359,45 @@ class SupervisorTest < ::Test::Unit::TestCase
|
|
319
359
|
assert_equal Fluent::Log::LEVEL_INFO, se_config[:log_level]
|
320
360
|
end
|
321
361
|
|
362
|
+
def test_load_config_with_multibyte_string
|
363
|
+
tmp_path = "#{TMP_DIR}/dir/test_multibyte_config.conf"
|
364
|
+
conf_str = %[
|
365
|
+
<source>
|
366
|
+
@type forward
|
367
|
+
@id forward_input
|
368
|
+
@label @INPUT
|
369
|
+
</source>
|
370
|
+
<label @INPUT>
|
371
|
+
<filter>
|
372
|
+
@type record_transformer
|
373
|
+
<record>
|
374
|
+
message こんにちは. ${record["name"]} has made a order of ${record["item"]} just now.
|
375
|
+
</record>
|
376
|
+
</filter>
|
377
|
+
<match>
|
378
|
+
@type stdout
|
379
|
+
</match>
|
380
|
+
</label>
|
381
|
+
]
|
382
|
+
FileUtils.mkdir_p(File.dirname(tmp_path))
|
383
|
+
File.open(tmp_path, "w:utf-8") {|file| file.write(conf_str) }
|
384
|
+
|
385
|
+
params = {}
|
386
|
+
params['workers'] = 1
|
387
|
+
params['use_v1_config'] = true
|
388
|
+
params['log_path'] = 'test/tmp/supervisor/log'
|
389
|
+
params['suppress_repeated_stacktrace'] = true
|
390
|
+
params['log_level'] = Fluent::Log::LEVEL_INFO
|
391
|
+
load_config_proc = Proc.new { Fluent::Supervisor.load_config(tmp_path, params) }
|
392
|
+
|
393
|
+
se_config = load_config_proc.call
|
394
|
+
conf = se_config[:fluentd_conf]
|
395
|
+
label = conf.elements.detect {|e| e.name == "label" }
|
396
|
+
filter = label.elements.detect {|e| e.name == "filter" }
|
397
|
+
record_transformer = filter.elements.detect {|e| e.name = "record_transformer" }
|
398
|
+
assert_equal(Encoding::UTF_8, record_transformer["message"].encoding)
|
399
|
+
end
|
400
|
+
|
322
401
|
def test_logger
|
323
402
|
opts = Fluent::Supervisor.default_options
|
324
403
|
sv = Fluent::Supervisor.new(opts)
|
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.
|
4
|
+
version: 0.14.18
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|