fluentd 0.12.20 → 0.12.21
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 +23 -0
- data/Rakefile +2 -2
- data/bin/fluent-debug +0 -1
- data/lib/fluent/agent.rb +12 -9
- data/lib/fluent/buffer.rb +9 -3
- data/lib/fluent/command/bundler_injection.rb +2 -0
- data/lib/fluent/command/cat.rb +1 -1
- data/lib/fluent/command/debug.rb +3 -2
- data/lib/fluent/command/fluentd.rb +3 -1
- data/lib/fluent/config.rb +4 -5
- data/lib/fluent/config/basic_parser.rb +3 -4
- data/lib/fluent/config/configure_proxy.rb +2 -0
- data/lib/fluent/config/dsl.rb +3 -0
- data/lib/fluent/config/element.rb +3 -2
- data/lib/fluent/config/literal_parser.rb +8 -5
- data/lib/fluent/config/parser.rb +5 -3
- data/lib/fluent/config/section.rb +3 -3
- data/lib/fluent/config/types.rb +44 -50
- data/lib/fluent/config/v1_parser.rb +8 -6
- data/lib/fluent/configurable.rb +8 -6
- data/lib/fluent/engine.rb +23 -11
- data/lib/fluent/event.rb +2 -0
- data/lib/fluent/event_router.rb +4 -2
- data/lib/fluent/filter.rb +6 -0
- data/lib/fluent/formatter.rb +27 -25
- data/lib/fluent/input.rb +5 -0
- data/lib/fluent/label.rb +2 -2
- data/lib/fluent/log.rb +5 -2
- data/lib/fluent/mixin.rb +4 -2
- data/lib/fluent/output.rb +45 -31
- data/lib/fluent/parser.rb +35 -25
- data/lib/fluent/plugin.rb +4 -0
- data/lib/fluent/plugin/buf_file.rb +9 -2
- data/lib/fluent/plugin/buf_memory.rb +7 -1
- data/lib/fluent/plugin/exec_util.rb +7 -2
- data/lib/fluent/plugin/filter_grep.rb +6 -3
- data/lib/fluent/plugin/filter_record_transformer.rb +52 -51
- data/lib/fluent/plugin/filter_stdout.rb +4 -1
- data/lib/fluent/plugin/in_debug_agent.rb +7 -5
- data/lib/fluent/plugin/in_dummy.rb +8 -3
- data/lib/fluent/plugin/in_exec.rb +16 -10
- data/lib/fluent/plugin/in_forward.rb +18 -11
- data/lib/fluent/plugin/in_gc_stat.rb +6 -2
- data/lib/fluent/plugin/in_http.rb +23 -14
- data/lib/fluent/plugin/in_monitor_agent.rb +24 -17
- data/lib/fluent/plugin/in_object_space.rb +9 -4
- data/lib/fluent/plugin/in_stream.rb +15 -6
- data/lib/fluent/plugin/in_syslog.rb +18 -12
- data/lib/fluent/plugin/in_tail.rb +61 -40
- data/lib/fluent/plugin/in_tcp.rb +3 -1
- data/lib/fluent/plugin/in_udp.rb +1 -1
- data/lib/fluent/plugin/out_copy.rb +5 -1
- data/lib/fluent/plugin/out_exec.rb +9 -6
- data/lib/fluent/plugin/out_exec_filter.rb +32 -25
- data/lib/fluent/plugin/out_file.rb +11 -5
- data/lib/fluent/plugin/out_forward.rb +30 -24
- data/lib/fluent/plugin/out_null.rb +2 -0
- data/lib/fluent/plugin/out_relabel.rb +2 -0
- data/lib/fluent/plugin/out_roundrobin.rb +3 -0
- data/lib/fluent/plugin/out_stdout.rb +3 -1
- data/lib/fluent/plugin/out_stream.rb +8 -8
- data/lib/fluent/plugin/socket_util.rb +12 -10
- data/lib/fluent/process.rb +14 -8
- data/lib/fluent/registry.rb +2 -2
- data/lib/fluent/root_agent.rb +16 -12
- data/lib/fluent/rpc.rb +7 -7
- data/lib/fluent/supervisor.rb +35 -69
- data/lib/fluent/system_config.rb +98 -0
- data/lib/fluent/test.rb +1 -1
- data/lib/fluent/test/base.rb +6 -1
- data/lib/fluent/test/filter_test.rb +4 -0
- data/lib/fluent/test/formatter_test.rb +3 -2
- data/lib/fluent/test/input_test.rb +6 -0
- data/lib/fluent/test/output_test.rb +4 -0
- data/lib/fluent/test/parser_test.rb +3 -2
- data/lib/fluent/timezone.rb +2 -0
- data/lib/fluent/version.rb +1 -1
- data/test/config/test_configurable.rb +11 -11
- data/test/config/test_configure_proxy.rb +1 -1
- data/test/config/test_system_config.rb +5 -5
- data/test/config/test_types.rb +70 -0
- data/test/plugin/test_filter_record_transformer.rb +72 -55
- data/test/plugin/test_in_forward.rb +4 -0
- data/test/plugin/test_in_tail.rb +73 -2
- data/test/test_config.rb +2 -2
- data/test/test_event_router.rb +1 -0
- data/test/test_output.rb +27 -3
- data/test/test_plugin_classes.rb +3 -0
- data/test/test_process.rb +1 -0
- data/test/test_root_agent.rb +5 -3
- metadata +3 -2
data/lib/fluent/test.rb
CHANGED
data/lib/fluent/test/base.rb
CHANGED
@@ -14,11 +14,15 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'fluent/engine'
|
18
|
+
require 'fluent/system_config'
|
19
|
+
require 'fluent/config'
|
20
|
+
|
17
21
|
module Fluent
|
18
22
|
module Test
|
19
23
|
def self.setup
|
20
24
|
Fluent.__send__(:remove_const, :Engine)
|
21
|
-
engine = Fluent.const_set(:Engine, EngineClass.new).init
|
25
|
+
engine = Fluent.const_set(:Engine, EngineClass.new).init(SystemConfig.new)
|
22
26
|
|
23
27
|
engine.define_singleton_method(:now=) {|n|
|
24
28
|
@now = n.to_i
|
@@ -47,6 +51,7 @@ module Fluent
|
|
47
51
|
end
|
48
52
|
@instance.router = Engine.root_agent.event_router
|
49
53
|
@instance.log = TestLogger.new
|
54
|
+
Engine.root_agent.instance_variable_set(:@log, @instance.log)
|
50
55
|
|
51
56
|
@config = Config.new
|
52
57
|
end
|
@@ -14,10 +14,11 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'fluent/formatter'
|
18
|
+
require 'fluent/config'
|
19
|
+
|
17
20
|
module Fluent
|
18
21
|
module Test
|
19
|
-
require 'fluent/config'
|
20
|
-
|
21
22
|
class FormatterTestDriver
|
22
23
|
def initialize(klass_or_str, proc=nil, &block)
|
23
24
|
if klass_or_str.is_a?(Class)
|
@@ -14,6 +14,12 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'fluent/input'
|
18
|
+
require 'fluent/buffer'
|
19
|
+
require 'fluent/engine'
|
20
|
+
require 'fluent/time'
|
21
|
+
require 'fluent/test/base'
|
22
|
+
|
17
23
|
module Fluent
|
18
24
|
class FileBuffer < BasicBuffer
|
19
25
|
def self.clear_buffer_paths
|
@@ -14,10 +14,11 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'fluent/parser'
|
18
|
+
require 'fluent/config'
|
19
|
+
|
17
20
|
module Fluent
|
18
21
|
module Test
|
19
|
-
require 'fluent/config'
|
20
|
-
|
21
22
|
class ParserTestDriver
|
22
23
|
def initialize(klass_or_str, format=nil, conf={}, &block)
|
23
24
|
if klass_or_str.is_a?(Class)
|
data/lib/fluent/timezone.rb
CHANGED
data/lib/fluent/version.rb
CHANGED
@@ -7,14 +7,14 @@ module ConfigurableSpec
|
|
7
7
|
class Base1
|
8
8
|
include Fluent::Configurable
|
9
9
|
|
10
|
-
config_param :node, :string, :
|
11
|
-
config_param :flag1, :bool, :
|
12
|
-
config_param :flag2, :bool, :
|
10
|
+
config_param :node, :string, default: "node"
|
11
|
+
config_param :flag1, :bool, default: false
|
12
|
+
config_param :flag2, :bool, default: true
|
13
13
|
|
14
14
|
config_param :name1, :string
|
15
15
|
config_param :name2, :string
|
16
|
-
config_param :name3, :string, :
|
17
|
-
config_param :name4, :string, :
|
16
|
+
config_param :name3, :string, default: "base1"
|
17
|
+
config_param :name4, :string, default: "base1"
|
18
18
|
|
19
19
|
config_param :opt1, :enum, list: [:foo, :bar, :baz]
|
20
20
|
config_param :opt2, :enum, list: [:foo, :bar, :baz], default: :foo
|
@@ -29,7 +29,7 @@ module ConfigurableSpec
|
|
29
29
|
config_set_default :name4, "base2"
|
30
30
|
config_set_default :opt1, :bar
|
31
31
|
config_param :name5, :string
|
32
|
-
config_param :name6, :string, :
|
32
|
+
config_param :name6, :string, default: "base2"
|
33
33
|
config_param :opt3, :enum, list: [:a, :b]
|
34
34
|
|
35
35
|
def get_all
|
@@ -41,7 +41,7 @@ module ConfigurableSpec
|
|
41
41
|
class Base3 < Base2
|
42
42
|
config_set_default :opt3, :a
|
43
43
|
config_section :node do
|
44
|
-
config_param :name, :string, :
|
44
|
+
config_param :name, :string, default: "node"
|
45
45
|
config_param :type, :string
|
46
46
|
end
|
47
47
|
config_section :branch, required: true, multi: true do
|
@@ -65,8 +65,8 @@ module ConfigurableSpec
|
|
65
65
|
config_set_default :opt3, :a
|
66
66
|
config_section :node, param_name: :nodes do
|
67
67
|
config_argument :num, :integer
|
68
|
-
config_param :name, :string, :
|
69
|
-
config_param :type, :string, :
|
68
|
+
config_param :name, :string, default: "node"
|
69
|
+
config_param :type, :string, default: "b4"
|
70
70
|
end
|
71
71
|
config_section :description1, required: false, multi: false do
|
72
72
|
config_argument :note, :string, default: "desc1"
|
@@ -151,11 +151,11 @@ module ConfigurableSpec
|
|
151
151
|
include Fluent::Configurable
|
152
152
|
|
153
153
|
config_param :normal_param, :string
|
154
|
-
config_param :secret_param, :string, :
|
154
|
+
config_param :secret_param, :string, secret: true
|
155
155
|
|
156
156
|
config_section :section do
|
157
157
|
config_param :normal_param2, :string
|
158
|
-
config_param :secret_param2, :string, :
|
158
|
+
config_param :secret_param2, :string, secret: true
|
159
159
|
end
|
160
160
|
end
|
161
161
|
end
|
@@ -127,7 +127,7 @@ module Fluent::Config
|
|
127
127
|
test 'does not permit description specification twice' do
|
128
128
|
@proxy.desc("description1")
|
129
129
|
assert_raise(ArgumentError) do
|
130
|
-
@proxy.config_param(:name, :string, :
|
130
|
+
@proxy.config_param(:name, :string, desc: "description2")
|
131
131
|
end
|
132
132
|
end
|
133
133
|
end
|
@@ -2,7 +2,7 @@ require_relative '../helper'
|
|
2
2
|
require 'fluent/configurable'
|
3
3
|
require 'fluent/config/element'
|
4
4
|
require 'fluent/config/section'
|
5
|
-
require 'fluent/
|
5
|
+
require 'fluent/system_config'
|
6
6
|
|
7
7
|
module Fluent::Config
|
8
8
|
class FakeLoggerInitializer
|
@@ -36,7 +36,7 @@ module Fluent::Config
|
|
36
36
|
</system>
|
37
37
|
EOS
|
38
38
|
s = FakeSupervisor.new
|
39
|
-
sc = Fluent::
|
39
|
+
sc = Fluent::SystemConfig.new(conf)
|
40
40
|
sc.apply(s)
|
41
41
|
assert_nil(sc.log_level)
|
42
42
|
assert_nil(sc.suppress_repeated_stacktrace)
|
@@ -63,7 +63,7 @@ module Fluent::Config
|
|
63
63
|
</system>
|
64
64
|
EOS
|
65
65
|
s = FakeSupervisor.new
|
66
|
-
sc = Fluent::
|
66
|
+
sc = Fluent::SystemConfig.new(conf)
|
67
67
|
sc.apply(s)
|
68
68
|
assert_not_nil(sc.instance_variable_get("@#{k}"))
|
69
69
|
key = (k == 'emit_error_log_interval' ? 'suppress_interval' : k)
|
@@ -74,7 +74,7 @@ module Fluent::Config
|
|
74
74
|
{'foo' => 'bar', 'hoge' => 'fuga'}.each { |k, v|
|
75
75
|
test "should not affect settable parameters with unknown #{k} parameter" do
|
76
76
|
s = FakeSupervisor.new
|
77
|
-
sc = Fluent::
|
77
|
+
sc = Fluent::SystemConfig.new({k => v})
|
78
78
|
sc.apply(s)
|
79
79
|
assert_nil(s.instance_variable_get(:@log_level))
|
80
80
|
assert_nil(s.instance_variable_get(:@suppress_repeated_stacktrace))
|
@@ -91,7 +91,7 @@ module Fluent::Config
|
|
91
91
|
</system>
|
92
92
|
EOS
|
93
93
|
s = FakeSupervisor.new
|
94
|
-
sc = Fluent::
|
94
|
+
sc = Fluent::SystemConfig.new(conf)
|
95
95
|
sc.apply(s)
|
96
96
|
assert_equal(Fluent::Log::LEVEL_WARN, s.instance_variable_get("@log").level)
|
97
97
|
end
|
data/test/config/test_types.rb
CHANGED
@@ -60,4 +60,74 @@ class TestConfigTypes < ::Test::Unit::TestCase
|
|
60
60
|
assert_nil Config.bool_value(10)
|
61
61
|
end
|
62
62
|
end
|
63
|
+
|
64
|
+
sub_test_case 'type converters for config_param definitions' do
|
65
|
+
test 'string' do
|
66
|
+
assert_equal 'test', Config::STRING_TYPE.call('test', {})
|
67
|
+
assert_equal '1', Config::STRING_TYPE.call('1', {})
|
68
|
+
assert_equal ' ', Config::STRING_TYPE.call(' ', {})
|
69
|
+
end
|
70
|
+
|
71
|
+
test 'enum' do
|
72
|
+
assert_equal :val, Config::ENUM_TYPE.call('val', {list: [:val, :value, :v]})
|
73
|
+
assert_equal :v, Config::ENUM_TYPE.call('v', {list: [:val, :value, :v]})
|
74
|
+
assert_equal :value, Config::ENUM_TYPE.call('value', {list: [:val, :value, :v]})
|
75
|
+
assert_raises(Fluent::ConfigError){ Config::ENUM_TYPE.call('x', {list: [:val, :value, :v]}) }
|
76
|
+
assert_raises(RuntimeError){ Config::ENUM_TYPE.call('val', {}) }
|
77
|
+
assert_raises(RuntimeError){ Config::ENUM_TYPE.call('val', {list: ["val", "value", "v"]}) }
|
78
|
+
end
|
79
|
+
|
80
|
+
test 'integer' do
|
81
|
+
assert_equal 1, Config::INTEGER_TYPE.call('1', {})
|
82
|
+
assert_equal 1, Config::INTEGER_TYPE.call('1.0', {})
|
83
|
+
assert_equal 1000, Config::INTEGER_TYPE.call('1_000', {})
|
84
|
+
assert_equal 1, Config::INTEGER_TYPE.call('1x', {})
|
85
|
+
end
|
86
|
+
|
87
|
+
test 'float' do
|
88
|
+
assert_equal 1.0, Config::FLOAT_TYPE.call('1', {})
|
89
|
+
assert_equal 1.0, Config::FLOAT_TYPE.call('1.0', {})
|
90
|
+
assert_equal 1.0, Config::FLOAT_TYPE.call('1.00', {})
|
91
|
+
assert_equal 1.0, Config::FLOAT_TYPE.call('1e0', {})
|
92
|
+
end
|
93
|
+
|
94
|
+
test 'size' do
|
95
|
+
assert_equal 1000, Config::SIZE_TYPE.call('1000', {})
|
96
|
+
assert_equal 1024, Config::SIZE_TYPE.call('1k', {})
|
97
|
+
assert_equal 1024*1024, Config::SIZE_TYPE.call('1m', {})
|
98
|
+
end
|
99
|
+
|
100
|
+
test 'bool' do
|
101
|
+
assert_equal true, Config::BOOL_TYPE.call('true', {})
|
102
|
+
assert_equal true, Config::BOOL_TYPE.call('yes', {})
|
103
|
+
assert_equal false, Config::BOOL_TYPE.call('no', {})
|
104
|
+
assert_equal false, Config::BOOL_TYPE.call('false', {})
|
105
|
+
|
106
|
+
assert_equal nil, Config::BOOL_TYPE.call('TRUE', {})
|
107
|
+
assert_equal nil, Config::BOOL_TYPE.call('True', {})
|
108
|
+
assert_equal nil, Config::BOOL_TYPE.call('Yes', {})
|
109
|
+
assert_equal nil, Config::BOOL_TYPE.call('No', {})
|
110
|
+
|
111
|
+
assert_equal true, Config::BOOL_TYPE.call('', {})
|
112
|
+
assert_equal nil, Config::BOOL_TYPE.call('unexpected_string', {})
|
113
|
+
end
|
114
|
+
|
115
|
+
test 'time' do
|
116
|
+
assert_equal 0, Config::TIME_TYPE.call('0', {})
|
117
|
+
assert_equal 1.0, Config::TIME_TYPE.call('1', {})
|
118
|
+
assert_equal 1.01, Config::TIME_TYPE.call('1.01', {})
|
119
|
+
assert_equal 1, Config::TIME_TYPE.call('1s', {})
|
120
|
+
assert_equal 60, Config::TIME_TYPE.call('1m', {})
|
121
|
+
assert_equal 3600, Config::TIME_TYPE.call('1h', {})
|
122
|
+
assert_equal 86400, Config::TIME_TYPE.call('1d', {})
|
123
|
+
end
|
124
|
+
|
125
|
+
test 'hash' do
|
126
|
+
assert_equal({"x"=>"v","k"=>1}, Config::HASH_TYPE.call('{"x":"v","k":1}', {}))
|
127
|
+
end
|
128
|
+
|
129
|
+
test 'array' do
|
130
|
+
assert_equal(["1","2",1], Config::ARRAY_TYPE.call('["1","2",1]', {}))
|
131
|
+
end
|
132
|
+
end
|
63
133
|
end
|
@@ -351,41 +351,41 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
|
|
351
351
|
{ "source" => nil },
|
352
352
|
]
|
353
353
|
expected_results = [
|
354
|
-
{ :
|
355
|
-
:
|
356
|
-
:
|
357
|
-
:
|
358
|
-
:
|
359
|
-
{ :
|
360
|
-
:
|
361
|
-
:
|
362
|
-
:
|
363
|
-
:
|
364
|
-
{ :
|
365
|
-
:
|
366
|
-
:
|
367
|
-
:
|
368
|
-
:
|
369
|
-
{ :
|
370
|
-
:
|
371
|
-
:
|
372
|
-
:
|
373
|
-
:
|
374
|
-
{ :
|
375
|
-
:
|
376
|
-
:
|
377
|
-
:
|
378
|
-
:
|
354
|
+
{ single: "string",
|
355
|
+
multiple: "stringstring",
|
356
|
+
with_prefix: "prefix-string",
|
357
|
+
with_suffix: "string-suffix",
|
358
|
+
with_quote: %Q{source[""]} },
|
359
|
+
{ single: 123.to_s,
|
360
|
+
multiple: "#{123.to_s}#{123.to_s}",
|
361
|
+
with_prefix: "prefix-#{123.to_s}",
|
362
|
+
with_suffix: "#{123.to_s}-suffix",
|
363
|
+
with_quote: %Q{source[""]} },
|
364
|
+
{ single: [1, 2].to_s,
|
365
|
+
multiple: "#{[1, 2].to_s}#{[1, 2].to_s}",
|
366
|
+
with_prefix: "prefix-#{[1, 2].to_s}",
|
367
|
+
with_suffix: "#{[1, 2].to_s}-suffix",
|
368
|
+
with_quote: %Q{source[""]} },
|
369
|
+
{ single: {a:1, b:2}.to_s,
|
370
|
+
multiple: "#{{a:1, b:2}.to_s}#{{a:1, b:2}.to_s}",
|
371
|
+
with_prefix: "prefix-#{{a:1, b:2}.to_s}",
|
372
|
+
with_suffix: "#{{a:1, b:2}.to_s}-suffix",
|
373
|
+
with_quote: %Q{source[""]} },
|
374
|
+
{ single: nil.to_s,
|
375
|
+
multiple: "#{nil.to_s}#{nil.to_s}",
|
376
|
+
with_prefix: "prefix-#{nil.to_s}",
|
377
|
+
with_suffix: "#{nil.to_s}-suffix",
|
378
|
+
with_quote: %Q{source[""]} },
|
379
379
|
]
|
380
380
|
actual_results = []
|
381
381
|
es = emit(config, msgs)
|
382
382
|
es.each_with_index do |(t, r), i|
|
383
383
|
actual_results << {
|
384
|
-
:
|
385
|
-
:
|
386
|
-
:
|
387
|
-
:
|
388
|
-
:
|
384
|
+
single: r["single"],
|
385
|
+
multiple: r["multiple"],
|
386
|
+
with_prefix: r["with_prefix"],
|
387
|
+
with_suffix: r["with_suffix"],
|
388
|
+
with_quote: r["with_quote"],
|
389
389
|
}
|
390
390
|
end
|
391
391
|
assert_equal(expected_results, actual_results)
|
@@ -410,35 +410,35 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
|
|
410
410
|
{ "source" => nil },
|
411
411
|
]
|
412
412
|
expected_results = [
|
413
|
-
{ :
|
414
|
-
:
|
415
|
-
:
|
416
|
-
:
|
417
|
-
{ :
|
418
|
-
:
|
419
|
-
:
|
420
|
-
:
|
421
|
-
{ :
|
422
|
-
:
|
423
|
-
:
|
424
|
-
:
|
425
|
-
{ :
|
426
|
-
:
|
427
|
-
:
|
428
|
-
:
|
429
|
-
{ :
|
430
|
-
:
|
431
|
-
:
|
432
|
-
:
|
413
|
+
{ single: "string",
|
414
|
+
multiple: "stringstring",
|
415
|
+
with_prefix: "prefix-string",
|
416
|
+
with_suffix: "string-suffix" },
|
417
|
+
{ single: 123,
|
418
|
+
multiple: "#{123.to_s}#{123.to_s}",
|
419
|
+
with_prefix: "prefix-#{123.to_s}",
|
420
|
+
with_suffix: "#{123.to_s}-suffix" },
|
421
|
+
{ single: [1, 2],
|
422
|
+
multiple: "#{[1, 2].to_s}#{[1, 2].to_s}",
|
423
|
+
with_prefix: "prefix-#{[1, 2].to_s}",
|
424
|
+
with_suffix: "#{[1, 2].to_s}-suffix" },
|
425
|
+
{ single: {a:1, b:2},
|
426
|
+
multiple: "#{{a:1, b:2}.to_s}#{{a:1, b:2}.to_s}",
|
427
|
+
with_prefix: "prefix-#{{a:1, b:2}.to_s}",
|
428
|
+
with_suffix: "#{{a:1, b:2}.to_s}-suffix" },
|
429
|
+
{ single: nil,
|
430
|
+
multiple: "#{nil.to_s}#{nil.to_s}",
|
431
|
+
with_prefix: "prefix-#{nil.to_s}",
|
432
|
+
with_suffix: "#{nil.to_s}-suffix" },
|
433
433
|
]
|
434
434
|
actual_results = []
|
435
435
|
es = emit(config, msgs)
|
436
436
|
es.each_with_index do |(t, r), i|
|
437
437
|
actual_results << {
|
438
|
-
:
|
439
|
-
:
|
440
|
-
:
|
441
|
-
:
|
438
|
+
single: r["single"],
|
439
|
+
multiple: r["multiple"],
|
440
|
+
with_prefix: r["with_prefix"],
|
441
|
+
with_suffix: r["with_suffix"],
|
442
442
|
}
|
443
443
|
end
|
444
444
|
assert_equal(expected_results, actual_results)
|
@@ -508,6 +508,23 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
|
|
508
508
|
end
|
509
509
|
end
|
510
510
|
|
511
|
+
test 'auto_typecast placeholder containing {} (enable_ruby yes)' do
|
512
|
+
config = %[
|
513
|
+
tag tag
|
514
|
+
enable_ruby yes
|
515
|
+
auto_typecast yes
|
516
|
+
<record>
|
517
|
+
foo ${record.map{|k,v|v}}
|
518
|
+
</record>
|
519
|
+
]
|
520
|
+
d = create_driver(config)
|
521
|
+
message = {"@timestamp" => "foo"}
|
522
|
+
es = d.run { d.emit(message, @time) }.filtered
|
523
|
+
es.each do |t, r|
|
524
|
+
assert_equal([message["@timestamp"]], r['foo'])
|
525
|
+
end
|
526
|
+
end
|
527
|
+
|
511
528
|
test 'expand fields starting with @ (enable_ruby yes)' do
|
512
529
|
config = %[
|
513
530
|
enable_ruby yes
|
@@ -522,7 +539,7 @@ class RecordTransformerFilterTest < Test::Unit::TestCase
|
|
522
539
|
assert_equal(message["@timestamp"], r['foo'])
|
523
540
|
end
|
524
541
|
end
|
525
|
-
end
|
542
|
+
end # test placeholders
|
526
543
|
|
527
544
|
test "compatibility test (enable_ruby yes)" do
|
528
545
|
config = %[
|