fluentd 0.12.12 → 0.12.13
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/example/in_forward.conf +7 -0
- data/example/out_forward.conf +6 -1
- data/lib/fluent/config/element.rb +4 -3
- data/lib/fluent/config/section.rb +4 -0
- data/lib/fluent/configurable.rb +1 -3
- data/lib/fluent/plugin/filter_record_transformer.rb +39 -11
- data/lib/fluent/plugin/out_forward.rb +45 -20
- data/lib/fluent/plugin/out_stdout.rb +4 -17
- data/lib/fluent/version.rb +1 -1
- data/test/config/test_configurable.rb +22 -5
- data/test/plugin/test_filter_record_transformer.rb +112 -1
- data/test/plugin/test_out_forward.rb +19 -0
- data/test/plugin/test_out_stdout.rb +3 -3
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8d2b210d487f331113e6ba6be6f9607d3cb0129
|
4
|
+
data.tar.gz: 83237ccc84a3af2e52d8824fdda9bc5ee14485a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 206acfb5ddab70b8c7b20b1b36c25a62f827c899c851bbbb98484159309184266597cbebd691c53cb23aa5fac7a6e77ebcbe1611ada8bf720583ba93ed26faf6
|
7
|
+
data.tar.gz: b5381b0ec5c92f33a30e021db328767582aa2753d651695073a27c84099c4cb9445c127a0dc9a31350dd441a1ad53d05ef3fe79d488d644faa0a228150dfe706
|
data/ChangeLog
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# v0.12
|
2
2
|
|
3
|
+
## Release 0.12.13 - 2015/07/09
|
4
|
+
|
5
|
+
### New features / Enhancement
|
6
|
+
|
7
|
+
* out_stdout: Support formatter plugins in out_stdout
|
8
|
+
https://github.com/fluent/fluentd/pull/617
|
9
|
+
* filter_record_transformer: Add "auto_typecast" parameter
|
10
|
+
https://github.com/fluent/fluentd/pull/620
|
11
|
+
* out_forward: Support DNS round robin
|
12
|
+
https://github.com/fluent/fluentd/pull/625
|
13
|
+
* out_forward: Support heartbeat_type none to disable heartbeat
|
14
|
+
https://github.com/fluent/fluentd/pull/626
|
15
|
+
|
16
|
+
### Bug fixes
|
17
|
+
|
18
|
+
* config: Fix secret option to support config_section
|
19
|
+
https://github.com/fluent/fluentd/pull/628
|
20
|
+
|
3
21
|
## Release 0.12.12 - 2015/06/12
|
4
22
|
|
5
23
|
### New features / Enhancement
|
data/example/out_forward.conf
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
<source>
|
2
|
-
type
|
2
|
+
type dummy
|
3
|
+
tag test
|
3
4
|
</source>
|
4
5
|
|
5
6
|
<match test>
|
@@ -7,18 +8,22 @@
|
|
7
8
|
|
8
9
|
<server>
|
9
10
|
# first server
|
11
|
+
host localhost
|
10
12
|
port 24224
|
11
13
|
</server>
|
12
14
|
<server>
|
13
15
|
# second server
|
16
|
+
host localhost
|
14
17
|
port 24225
|
15
18
|
</server>
|
16
19
|
<server>
|
17
20
|
# second server
|
21
|
+
host localhost
|
18
22
|
port 24226
|
19
23
|
standby
|
20
24
|
</server>
|
21
25
|
|
26
|
+
flush_interval 1
|
22
27
|
send_timeout 60
|
23
28
|
heartbeat_type udp
|
24
29
|
heartbeat_interval 1
|
@@ -118,11 +118,12 @@ module Fluent
|
|
118
118
|
end
|
119
119
|
|
120
120
|
def to_masked_element
|
121
|
-
|
121
|
+
new_elems = @elements.map { |e| e.to_masked_element }
|
122
|
+
new_elem = Element.new(@name, @arg, {}, new_elems, @unused)
|
122
123
|
each_pair { |k, v|
|
123
|
-
|
124
|
+
new_elem[k] = secret_param?(k) ? 'xxxxxx' : v
|
124
125
|
}
|
125
|
-
|
126
|
+
new_elem
|
126
127
|
end
|
127
128
|
|
128
129
|
def secret_param?(key)
|
@@ -121,6 +121,10 @@ module Fluent
|
|
121
121
|
proxy.sections.each do |name, subproxy|
|
122
122
|
varname = subproxy.param_name.to_sym
|
123
123
|
elements = (conf.respond_to?(:elements) ? conf.elements : []).select{ |e| e.name == subproxy.name.to_s || e.name == subproxy.alias.to_s }
|
124
|
+
# set subproxy for secret option
|
125
|
+
elements.each { |element|
|
126
|
+
element.corresponding_proxies << subproxy
|
127
|
+
}
|
124
128
|
|
125
129
|
if subproxy.required? && elements.size < 1
|
126
130
|
logger.error "config error in:\n#{conf}"
|
data/lib/fluent/configurable.rb
CHANGED
@@ -45,12 +45,10 @@ module Fluent
|
|
45
45
|
|
46
46
|
def configure(conf)
|
47
47
|
@config = conf
|
48
|
-
if class_name = self.class.name # Class.new in tests returns nil so it should be skipped.
|
49
|
-
@config.corresponding_proxies << self.class.configure_proxy(class_name)
|
50
|
-
end
|
51
48
|
|
52
49
|
logger = self.respond_to?(:log) ? log : $log
|
53
50
|
proxy = self.class.merged_configure_proxy
|
51
|
+
conf.corresponding_proxies << proxy
|
54
52
|
|
55
53
|
root = Fluent::Config::SectionGenerator.generate(proxy, conf, logger)
|
56
54
|
@config_root_section = root
|
@@ -30,6 +30,7 @@ module Fluent
|
|
30
30
|
config_param :renew_record, :bool, :default => false
|
31
31
|
config_param :renew_time_key, :string, :default => nil
|
32
32
|
config_param :enable_ruby, :bool, :default => false
|
33
|
+
config_param :auto_typecast, :bool, :default => false # false for lower version compatibility
|
33
34
|
|
34
35
|
def configure(conf)
|
35
36
|
super
|
@@ -52,15 +53,19 @@ module Fluent
|
|
52
53
|
@keep_keys = @keep_keys.split(',')
|
53
54
|
end
|
54
55
|
|
56
|
+
placeholder_expander_params = {
|
57
|
+
:log => log,
|
58
|
+
:auto_typecast => @auto_typecast,
|
59
|
+
}
|
55
60
|
@placeholder_expander =
|
56
61
|
if @enable_ruby
|
57
62
|
# require utilities which would be used in ruby placeholders
|
58
63
|
require 'pathname'
|
59
64
|
require 'uri'
|
60
65
|
require 'cgi'
|
61
|
-
RubyPlaceholderExpander.new(
|
66
|
+
RubyPlaceholderExpander.new(placeholder_expander_params)
|
62
67
|
else
|
63
|
-
PlaceholderExpander.new(
|
68
|
+
PlaceholderExpander.new(placeholder_expander_params)
|
64
69
|
end
|
65
70
|
|
66
71
|
@hostname = Socket.gethostname
|
@@ -124,7 +129,7 @@ module Fluent
|
|
124
129
|
elsif value.is_a?(Hash)
|
125
130
|
new_value = {}
|
126
131
|
value.each_pair do |k, v|
|
127
|
-
new_value[@placeholder_expander.expand(k)] = expand_placeholders(v)
|
132
|
+
new_value[@placeholder_expander.expand(k, true)] = expand_placeholders(v)
|
128
133
|
end
|
129
134
|
elsif value.is_a?(Array)
|
130
135
|
new_value = []
|
@@ -159,8 +164,9 @@ module Fluent
|
|
159
164
|
class PlaceholderExpander
|
160
165
|
attr_reader :placeholders, :log
|
161
166
|
|
162
|
-
def initialize(
|
163
|
-
@log = log
|
167
|
+
def initialize(params)
|
168
|
+
@log = params[:log]
|
169
|
+
@auto_typecast = params[:auto_typecast]
|
164
170
|
end
|
165
171
|
|
166
172
|
def prepare_placeholders(time, record, opts)
|
@@ -182,19 +188,34 @@ module Fluent
|
|
182
188
|
@placeholders = placeholders
|
183
189
|
end
|
184
190
|
|
185
|
-
def expand(str)
|
191
|
+
def expand(str, force_stringify=false)
|
192
|
+
if @auto_typecast and !force_stringify
|
193
|
+
single_placeholder_matched = str.match(/\A(\${[^}]+}|__[A-Z_]+__)\z/)
|
194
|
+
if single_placeholder_matched
|
195
|
+
log_unknown_placeholder($1)
|
196
|
+
return @placeholders[single_placeholder_matched[1]]
|
197
|
+
end
|
198
|
+
end
|
186
199
|
str.gsub(/(\${[^}]+}|__[A-Z_]+__)/) {
|
187
|
-
|
200
|
+
log_unknown_placeholder($1)
|
188
201
|
@placeholders[$1]
|
189
202
|
}
|
190
203
|
end
|
204
|
+
|
205
|
+
private
|
206
|
+
def log_unknown_placeholder(placeholder)
|
207
|
+
unless @placeholders.include?(placeholder)
|
208
|
+
log.warn "unknown placeholder `#{placeholder}` found"
|
209
|
+
end
|
210
|
+
end
|
191
211
|
end
|
192
212
|
|
193
213
|
class RubyPlaceholderExpander
|
194
214
|
attr_reader :placeholders, :log
|
195
215
|
|
196
|
-
def initialize(
|
197
|
-
@log = log
|
216
|
+
def initialize(params)
|
217
|
+
@log = params[:log]
|
218
|
+
@auto_typecast = params[:auto_typecast]
|
198
219
|
end
|
199
220
|
|
200
221
|
# Get placeholders as a struct
|
@@ -209,8 +230,15 @@ module Fluent
|
|
209
230
|
@placeholders = struct
|
210
231
|
end
|
211
232
|
|
212
|
-
def expand(str)
|
213
|
-
|
233
|
+
def expand(str, force_stringify=false)
|
234
|
+
if @auto_typecast and !force_stringify
|
235
|
+
single_placeholder_matched = str.match(/\A\${([^}]+)}\z/)
|
236
|
+
if single_placeholder_matched
|
237
|
+
code = single_placeholder_matched[1]
|
238
|
+
return eval code, @placeholders.instance_eval { binding }
|
239
|
+
end
|
240
|
+
end
|
241
|
+
interpolated = str.gsub(/\$\{([^}]+)\}/, '#{\1}') # ${..} => #{..}
|
214
242
|
eval "\"#{interpolated}\"", @placeholders.instance_eval { binding }
|
215
243
|
rescue => e
|
216
244
|
log.warn "failed to expand `#{str}`", :error_class => e.class, :error => e.message
|
@@ -43,8 +43,10 @@ module Fluent
|
|
43
43
|
:tcp
|
44
44
|
when 'udp'
|
45
45
|
:udp
|
46
|
+
when 'none'
|
47
|
+
:none
|
46
48
|
else
|
47
|
-
raise ConfigError, "forward output heartbeat type should be 'tcp' or '
|
49
|
+
raise ConfigError, "forward output heartbeat type should be 'tcp', 'udp', or 'none'"
|
48
50
|
end
|
49
51
|
end
|
50
52
|
config_param :heartbeat_interval, :time, :default => 1
|
@@ -111,7 +113,12 @@ module Fluent
|
|
111
113
|
|
112
114
|
node_conf = NodeConfig.new(name, host, port, weight, standby, failure,
|
113
115
|
@phi_threshold, recover_sample_size, @expire_dns_cache, @phi_failure_detector)
|
114
|
-
|
116
|
+
|
117
|
+
if @heartbeat_type == :none
|
118
|
+
@nodes << NoneHeartbeatNode.new(log, node_conf)
|
119
|
+
else
|
120
|
+
@nodes << Node.new(log, node_conf)
|
121
|
+
end
|
115
122
|
log.info "adding forwarding server '#{name}'", :host=>host, :port=>port, :weight=>weight, :plugin_id=>plugin_id
|
116
123
|
}
|
117
124
|
end
|
@@ -123,32 +130,36 @@ module Fluent
|
|
123
130
|
rebuild_weight_array
|
124
131
|
@rr = 0
|
125
132
|
|
126
|
-
@
|
133
|
+
unless @heartbeat_type == :none
|
134
|
+
@loop = Coolio::Loop.new
|
127
135
|
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
136
|
+
if @heartbeat_type == :udp
|
137
|
+
# assuming all hosts use udp
|
138
|
+
@usock = SocketUtil.create_udp_socket(@nodes.first.host)
|
139
|
+
@usock.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK)
|
140
|
+
@hb = HeartbeatHandler.new(@usock, method(:on_heartbeat))
|
141
|
+
@loop.attach(@hb)
|
142
|
+
end
|
135
143
|
|
136
|
-
|
137
|
-
|
144
|
+
@timer = HeartbeatRequestTimer.new(@heartbeat_interval, method(:on_timer))
|
145
|
+
@loop.attach(@timer)
|
138
146
|
|
139
|
-
|
147
|
+
@thread = Thread.new(&method(:run))
|
148
|
+
end
|
140
149
|
end
|
141
150
|
|
142
151
|
def shutdown
|
143
152
|
@finished = true
|
144
|
-
@loop
|
145
|
-
|
146
|
-
|
153
|
+
if @loop
|
154
|
+
@loop.watchers.each {|w| w.detach }
|
155
|
+
@loop.stop
|
156
|
+
end
|
157
|
+
@thread.join if @thread
|
147
158
|
@usock.close if @usock
|
148
159
|
end
|
149
160
|
|
150
161
|
def run
|
151
|
-
@loop.run
|
162
|
+
@loop.run if @loop
|
152
163
|
rescue
|
153
164
|
log.error "unexpected error", :error=>$!.to_s
|
154
165
|
log.error_backtrace
|
@@ -460,9 +471,8 @@ module Fluent
|
|
460
471
|
end
|
461
472
|
|
462
473
|
def resolve_dns!
|
463
|
-
|
464
|
-
port,
|
465
|
-
return resolved_host
|
474
|
+
# sample to support dns round robin
|
475
|
+
Socket.getaddrinfo(@host, @port, nil, Socket::SOCK_STREAM).sample[3]
|
466
476
|
end
|
467
477
|
private :resolve_dns!
|
468
478
|
|
@@ -515,6 +525,21 @@ module Fluent
|
|
515
525
|
end
|
516
526
|
end
|
517
527
|
|
528
|
+
# Override Node to disable heartbeat
|
529
|
+
class NoneHeartbeatNode < Node
|
530
|
+
def available?
|
531
|
+
true
|
532
|
+
end
|
533
|
+
|
534
|
+
def tick
|
535
|
+
false
|
536
|
+
end
|
537
|
+
|
538
|
+
def heartbeat(detect=true)
|
539
|
+
true
|
540
|
+
end
|
541
|
+
end
|
542
|
+
|
518
543
|
class FailureDetector
|
519
544
|
PHI_FACTOR = 1.0 / Math.log(10.0)
|
520
545
|
SAMPLE_SIZE = 1000
|
@@ -18,30 +18,17 @@ module Fluent
|
|
18
18
|
class StdoutOutput < Output
|
19
19
|
Plugin.register_output('stdout', self)
|
20
20
|
|
21
|
-
|
22
|
-
:json => Proc.new {|record| Yajl.dump(record) },
|
23
|
-
:hash => Proc.new {|record| record.to_s },
|
24
|
-
}
|
25
|
-
|
26
|
-
config_param :output_type, :default => :json do |val|
|
27
|
-
case val.downcase
|
28
|
-
when 'json'
|
29
|
-
:json
|
30
|
-
when 'hash'
|
31
|
-
:hash
|
32
|
-
else
|
33
|
-
raise ConfigError, "stdout output output_type should be 'json' or 'hash'"
|
34
|
-
end
|
35
|
-
end
|
21
|
+
config_param :output_type, :default => 'json'
|
36
22
|
|
37
23
|
def configure(conf)
|
38
24
|
super
|
39
|
-
@
|
25
|
+
@formatter = Plugin.new_formatter(@output_type)
|
26
|
+
@formatter.configure(conf)
|
40
27
|
end
|
41
28
|
|
42
29
|
def emit(tag, es, chain)
|
43
30
|
es.each {|time,record|
|
44
|
-
$log.write "#{Time.at(time).localtime} #{tag}: #{@
|
31
|
+
$log.write "#{Time.at(time).localtime} #{tag}: #{@formatter.format(tag, time, record).chomp}\n"
|
45
32
|
}
|
46
33
|
$log.flush
|
47
34
|
|
data/lib/fluent/version.rb
CHANGED
@@ -152,6 +152,11 @@ module ConfigurableSpec
|
|
152
152
|
|
153
153
|
config_param :normal_param, :string
|
154
154
|
config_param :secret_param, :string, :secret => true
|
155
|
+
|
156
|
+
config_section :section do
|
157
|
+
config_param :normal_param2, :string
|
158
|
+
config_param :secret_param2, :string, :secret => true
|
159
|
+
end
|
155
160
|
end
|
156
161
|
end
|
157
162
|
|
@@ -686,8 +691,14 @@ module Fluent::Config
|
|
686
691
|
end
|
687
692
|
|
688
693
|
sub_test_case ':secret option' do
|
694
|
+
def e(name, arg = '', attrs = {}, elements = [])
|
695
|
+
attrs_str_keys = {}
|
696
|
+
attrs.each { |key, value| attrs_str_keys[key.to_s] = value }
|
697
|
+
Fluent::Config::Element.new(name, arg, attrs_str_keys, elements)
|
698
|
+
end
|
699
|
+
|
689
700
|
setup do
|
690
|
-
@conf =
|
701
|
+
@conf = e('ROOT', '', {'normal_param' => 'normal', 'secret_param' => 'secret'}, [e('section', '', {'normal_param2' => 'normal', 'secret_param2' => 'secret'} )])
|
691
702
|
@example = ConfigurableSpec::Example5.new
|
692
703
|
@example.configure(@conf)
|
693
704
|
end
|
@@ -700,16 +711,22 @@ module Fluent::Config
|
|
700
711
|
end
|
701
712
|
|
702
713
|
test 'config returns masked configuration' do
|
703
|
-
@example.config
|
714
|
+
conf = @example.config
|
715
|
+
conf.each_pair { |key, value|
|
704
716
|
assert_secret_param(key, value)
|
705
717
|
}
|
718
|
+
conf.elements.each { |element|
|
719
|
+
element.each_pair { |key, value|
|
720
|
+
assert_secret_param(key, value)
|
721
|
+
}
|
722
|
+
}
|
706
723
|
end
|
707
724
|
|
708
725
|
def assert_secret_param(key, value)
|
709
726
|
case key
|
710
|
-
when 'normal_param'
|
711
|
-
assert_equal '
|
712
|
-
when 'secret_param'
|
727
|
+
when 'normal_param', 'normal_param2'
|
728
|
+
assert_equal 'normal', value
|
729
|
+
when 'secret_param', 'secret_param2'
|
713
730
|
assert_equal 'xxxxxx', value
|
714
731
|
end
|
715
732
|
end
|
@@ -172,7 +172,12 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
|
|
172
172
|
yield d if block_given?
|
173
173
|
d.run {
|
174
174
|
msgs.each do |msg|
|
175
|
-
|
175
|
+
record = {
|
176
|
+
'eventType0' => 'bar',
|
177
|
+
'message' => msg,
|
178
|
+
}
|
179
|
+
record = record.merge(msg) if msg.is_a?(Hash)
|
180
|
+
d.emit(record, @time)
|
176
181
|
end
|
177
182
|
}.filtered
|
178
183
|
end
|
@@ -325,6 +330,112 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
|
|
325
330
|
assert_equal({@hostname=>'hostname',"foo.#{@tag}"=>'tag'}, r)
|
326
331
|
end
|
327
332
|
end
|
333
|
+
|
334
|
+
test "disabled typecasting of values with enable_ruby #{enable_ruby}" do
|
335
|
+
config = %[
|
336
|
+
auto_typecast false
|
337
|
+
enable_ruby #{enable_ruby}
|
338
|
+
<record>
|
339
|
+
single ${source}
|
340
|
+
multiple ${source}${source}
|
341
|
+
with_prefix prefix-${source}
|
342
|
+
with_suffix ${source}-suffix
|
343
|
+
</record>
|
344
|
+
]
|
345
|
+
msgs = [
|
346
|
+
{ "source" => "string" },
|
347
|
+
{ "source" => 123 },
|
348
|
+
{ "source" => [1, 2] },
|
349
|
+
{ "source" => {a:1, b:2} },
|
350
|
+
{ "source" => nil },
|
351
|
+
]
|
352
|
+
expected_results = [
|
353
|
+
{ :single => "string",
|
354
|
+
:multiple => "stringstring",
|
355
|
+
:with_prefix => "prefix-string",
|
356
|
+
:with_suffix => "string-suffix" },
|
357
|
+
{ :single => 123.to_s,
|
358
|
+
:multiple => "#{123.to_s}#{123.to_s}",
|
359
|
+
:with_prefix => "prefix-#{123.to_s}",
|
360
|
+
:with_suffix => "#{123.to_s}-suffix" },
|
361
|
+
{ :single => [1, 2].to_s,
|
362
|
+
:multiple => "#{[1, 2].to_s}#{[1, 2].to_s}",
|
363
|
+
:with_prefix => "prefix-#{[1, 2].to_s}",
|
364
|
+
:with_suffix => "#{[1, 2].to_s}-suffix" },
|
365
|
+
{ :single => {a:1, b:2}.to_s,
|
366
|
+
:multiple => "#{{a:1, b:2}.to_s}#{{a:1, b:2}.to_s}",
|
367
|
+
:with_prefix => "prefix-#{{a:1, b:2}.to_s}",
|
368
|
+
:with_suffix => "#{{a:1, b:2}.to_s}-suffix" },
|
369
|
+
{ :single => nil.to_s,
|
370
|
+
:multiple => "#{nil.to_s}#{nil.to_s}",
|
371
|
+
:with_prefix => "prefix-#{nil.to_s}",
|
372
|
+
:with_suffix => "#{nil.to_s}-suffix" },
|
373
|
+
]
|
374
|
+
actual_results = []
|
375
|
+
es = emit(config, msgs)
|
376
|
+
es.each_with_index do |(t, r), i|
|
377
|
+
actual_results << {
|
378
|
+
:single => r["single"],
|
379
|
+
:multiple => r["multiple"],
|
380
|
+
:with_prefix => r["with_prefix"],
|
381
|
+
:with_suffix => r["with_suffix"],
|
382
|
+
}
|
383
|
+
end
|
384
|
+
assert_equal(expected_results, actual_results)
|
385
|
+
end
|
386
|
+
|
387
|
+
test "enabled typecasting of values with enable_ruby #{enable_ruby}" do
|
388
|
+
config = %[
|
389
|
+
auto_typecast yes
|
390
|
+
enable_ruby #{enable_ruby}
|
391
|
+
<record>
|
392
|
+
single ${source}
|
393
|
+
multiple ${source}${source}
|
394
|
+
with_prefix prefix-${source}
|
395
|
+
with_suffix ${source}-suffix
|
396
|
+
</record>
|
397
|
+
]
|
398
|
+
msgs = [
|
399
|
+
{ "source" => "string" },
|
400
|
+
{ "source" => 123 },
|
401
|
+
{ "source" => [1, 2] },
|
402
|
+
{ "source" => {a:1, b:2} },
|
403
|
+
{ "source" => nil },
|
404
|
+
]
|
405
|
+
expected_results = [
|
406
|
+
{ :single => "string",
|
407
|
+
:multiple => "stringstring",
|
408
|
+
:with_prefix => "prefix-string",
|
409
|
+
:with_suffix => "string-suffix" },
|
410
|
+
{ :single => 123,
|
411
|
+
:multiple => "#{123.to_s}#{123.to_s}",
|
412
|
+
:with_prefix => "prefix-#{123.to_s}",
|
413
|
+
:with_suffix => "#{123.to_s}-suffix" },
|
414
|
+
{ :single => [1, 2],
|
415
|
+
:multiple => "#{[1, 2].to_s}#{[1, 2].to_s}",
|
416
|
+
:with_prefix => "prefix-#{[1, 2].to_s}",
|
417
|
+
:with_suffix => "#{[1, 2].to_s}-suffix" },
|
418
|
+
{ :single => {a:1, b:2},
|
419
|
+
:multiple => "#{{a:1, b:2}.to_s}#{{a:1, b:2}.to_s}",
|
420
|
+
:with_prefix => "prefix-#{{a:1, b:2}.to_s}",
|
421
|
+
:with_suffix => "#{{a:1, b:2}.to_s}-suffix" },
|
422
|
+
{ :single => nil,
|
423
|
+
:multiple => "#{nil.to_s}#{nil.to_s}",
|
424
|
+
:with_prefix => "prefix-#{nil.to_s}",
|
425
|
+
:with_suffix => "#{nil.to_s}-suffix" },
|
426
|
+
]
|
427
|
+
actual_results = []
|
428
|
+
es = emit(config, msgs)
|
429
|
+
es.each_with_index do |(t, r), i|
|
430
|
+
actual_results << {
|
431
|
+
:single => r["single"],
|
432
|
+
:multiple => r["multiple"],
|
433
|
+
:with_prefix => r["with_prefix"],
|
434
|
+
:with_suffix => r["with_suffix"],
|
435
|
+
}
|
436
|
+
end
|
437
|
+
assert_equal(expected_results, actual_results)
|
438
|
+
end
|
328
439
|
end
|
329
440
|
|
330
441
|
test 'unknown placeholder (enable_ruby no)' do
|
@@ -59,6 +59,11 @@ class ForwardOutputTest < Test::Unit::TestCase
|
|
59
59
|
assert_equal :tcp, d.instance.heartbeat_type
|
60
60
|
end
|
61
61
|
|
62
|
+
def test_configure_none_heartbeat
|
63
|
+
d = create_driver(CONFIG + "\nheartbeat_type none")
|
64
|
+
assert_equal :none, d.instance.heartbeat_type
|
65
|
+
end
|
66
|
+
|
62
67
|
def test_phi_failure_detector
|
63
68
|
d = create_driver(CONFIG + %[phi_failure_detector false \n phi_threshold 0])
|
64
69
|
node = d.instance.nodes.first
|
@@ -327,6 +332,20 @@ class ForwardOutputTest < Test::Unit::TestCase
|
|
327
332
|
}.configure(conf).inject_router()
|
328
333
|
end
|
329
334
|
|
335
|
+
def test_heartbeat_type_none
|
336
|
+
d = create_driver(CONFIG + "\nheartbeat_type none")
|
337
|
+
node = d.instance.nodes.first
|
338
|
+
assert_equal Fluent::ForwardOutput::NoneHeartbeatNode, node.class
|
339
|
+
|
340
|
+
d.instance.start
|
341
|
+
assert_nil d.instance.instance_variable_get(:@loop) # no HeartbeatHandler, or HeartbeatRequestTimer
|
342
|
+
assert_nil d.instance.instance_variable_get(:@thread) # no HeartbeatHandler, or HeartbeatRequestTimer
|
343
|
+
|
344
|
+
stub(node.failure).phi { raise 'Should not be called' }
|
345
|
+
node.tick
|
346
|
+
assert_equal node.available, true
|
347
|
+
end
|
348
|
+
|
330
349
|
class DummyEngineDriver < Fluent::Test::TestDriver
|
331
350
|
def initialize(klass, &block)
|
332
351
|
super(klass, &block)
|
@@ -15,15 +15,15 @@ class StdoutOutputTest < Test::Unit::TestCase
|
|
15
15
|
|
16
16
|
def test_configure
|
17
17
|
d = create_driver
|
18
|
-
assert_equal
|
18
|
+
assert_equal 'json', d.instance.output_type
|
19
19
|
end
|
20
20
|
|
21
21
|
def test_configure_output_type
|
22
22
|
d = create_driver(CONFIG + "\noutput_type json")
|
23
|
-
assert_equal
|
23
|
+
assert_equal 'json', d.instance.output_type
|
24
24
|
|
25
25
|
d = create_driver(CONFIG + "\noutput_type hash")
|
26
|
-
assert_equal
|
26
|
+
assert_equal 'hash', d.instance.output_type
|
27
27
|
|
28
28
|
assert_raise(Fluent::ConfigError) do
|
29
29
|
d = create_driver(CONFIG + "\noutput_type foo")
|
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.12.
|
4
|
+
version: 0.12.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -292,6 +292,7 @@ files:
|
|
292
292
|
- bin/fluent-gem
|
293
293
|
- bin/fluentd
|
294
294
|
- example/filter_stdout.conf
|
295
|
+
- example/in_forward.conf
|
295
296
|
- example/in_http.conf
|
296
297
|
- example/in_syslog.conf
|
297
298
|
- example/in_tail.conf
|