fluentd 0.14.4 → 0.14.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 +3 -0
- data/example/in_forward_client.conf +37 -0
- data/example/in_forward_shared_key.conf +15 -0
- data/example/in_forward_users.conf +24 -0
- data/example/out_forward.conf +13 -13
- data/example/out_forward_client.conf +109 -0
- data/example/out_forward_shared_key.conf +36 -0
- data/example/out_forward_users.conf +65 -0
- data/example/{out_buffered_null.conf → out_null.conf} +10 -6
- data/example/secondary_file.conf +41 -0
- data/lib/fluent/agent.rb +3 -1
- data/lib/fluent/plugin/buffer.rb +5 -1
- data/lib/fluent/plugin/in_forward.rb +300 -50
- data/lib/fluent/plugin/in_tail.rb +41 -85
- data/lib/fluent/plugin/multi_output.rb +4 -0
- data/lib/fluent/plugin/out_forward.rb +326 -209
- data/lib/fluent/plugin/out_null.rb +37 -0
- data/lib/fluent/plugin/out_secondary_file.rb +128 -0
- data/lib/fluent/plugin/out_stdout.rb +38 -2
- data/lib/fluent/plugin/output.rb +13 -5
- data/lib/fluent/root_agent.rb +1 -1
- data/lib/fluent/test/startup_shutdown.rb +33 -0
- data/lib/fluent/version.rb +1 -1
- data/test/plugin/test_in_forward.rb +906 -441
- data/test/plugin/test_in_monitor_agent.rb +4 -0
- data/test/plugin/test_in_tail.rb +681 -663
- data/test/plugin/test_out_forward.rb +150 -208
- data/test/plugin/test_out_null.rb +85 -9
- data/test/plugin/test_out_secondary_file.rb +432 -0
- data/test/plugin/test_out_stdout.rb +143 -45
- data/test/test_root_agent.rb +42 -0
- metadata +14 -9
- data/lib/fluent/plugin/out_buffered_null.rb +0 -59
- data/lib/fluent/plugin/out_buffered_stdout.rb +0 -70
- data/test/plugin/test_out_buffered_null.rb +0 -79
- data/test/plugin/test_out_buffered_stdout.rb +0 -122
@@ -14,70 +14,168 @@ class StdoutOutputTest < Test::Unit::TestCase
|
|
14
14
|
Fluent::Test::Driver::Output.new(Fluent::Plugin::StdoutOutput).configure(conf)
|
15
15
|
end
|
16
16
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
sub_test_case 'non-buffered' do
|
18
|
+
test 'configure' do
|
19
|
+
d = create_driver
|
20
|
+
assert_equal [], d.instance.formatter_configs
|
21
|
+
end
|
21
22
|
|
22
|
-
|
23
|
-
|
24
|
-
|
23
|
+
test 'configure output_type' do
|
24
|
+
d = create_driver(CONFIG + "\noutput_type json")
|
25
|
+
assert_equal 'json', d.instance.formatter_configs.first[:@type]
|
25
26
|
|
26
|
-
|
27
|
-
|
27
|
+
d = create_driver(CONFIG + "\noutput_type hash")
|
28
|
+
assert_equal 'hash', d.instance.formatter_configs.first[:@type]
|
28
29
|
|
29
|
-
|
30
|
-
|
30
|
+
assert_raise(Fluent::ConfigError) do
|
31
|
+
d = create_driver(CONFIG + "\noutput_type foo")
|
32
|
+
end
|
31
33
|
end
|
32
|
-
end
|
33
34
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
35
|
+
test 'emit with default configuration' do
|
36
|
+
d = create_driver
|
37
|
+
time = event_time()
|
38
|
+
out = capture_log do
|
39
|
+
d.run(default_tag: 'test') do
|
40
|
+
d.feed(time, {'test' => 'test1'})
|
41
|
+
end
|
40
42
|
end
|
43
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test1\"}\n", out
|
41
44
|
end
|
42
|
-
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test1\"}\n", out
|
43
|
-
end
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
46
|
+
data('oj' => 'oj', 'yajl' => 'yajl')
|
47
|
+
test 'emit in json format' do |data|
|
48
|
+
d = create_driver(CONFIG + "\noutput_type json\njson_parser #{data}")
|
49
|
+
time = event_time()
|
50
|
+
out = capture_log do
|
51
|
+
d.run(default_tag: 'test') do
|
52
|
+
d.feed(time, {'test' => 'test1'})
|
53
|
+
end
|
54
|
+
end
|
55
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test1\"}\n", out
|
56
|
+
|
57
|
+
if data == 'yajl'
|
58
|
+
# NOTE: Float::NAN is not jsonable
|
59
|
+
assert_raise(Yajl::EncodeError) { d.feed('test', time, {'test' => Float::NAN}) }
|
60
|
+
else
|
61
|
+
out = capture_log { d.feed('test', time, {'test' => Float::NAN}) }
|
62
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\":NaN}\n", out
|
52
63
|
end
|
53
64
|
end
|
54
|
-
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test1\"}\n", out
|
55
65
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
66
|
+
test 'emit in hash format' do
|
67
|
+
d = create_driver(CONFIG + "\noutput_type hash")
|
68
|
+
time = event_time()
|
69
|
+
out = capture_log do
|
70
|
+
d.run(default_tag: 'test') do
|
71
|
+
d.feed(time, {'test' => 'test2'})
|
72
|
+
end
|
73
|
+
end
|
74
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\"=>\"test2\"}\n", out
|
75
|
+
|
76
|
+
# NOTE: Float::NAN is not jsonable, but hash string can output it.
|
60
77
|
out = capture_log { d.feed('test', time, {'test' => Float::NAN}) }
|
61
|
-
assert_equal "#{Time.at(time).localtime} test: {\"test\"
|
78
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\"=>NaN}\n", out
|
62
79
|
end
|
63
80
|
end
|
64
81
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
d.
|
70
|
-
|
82
|
+
sub_test_case 'buffered' do
|
83
|
+
test 'configure' do
|
84
|
+
d = create_driver(config_element("ROOT", "", {}, [config_element("buffer")]))
|
85
|
+
assert_equal [], d.instance.formatter_configs
|
86
|
+
assert_equal 10 * 1024, d.instance.buffer_config.chunk_limit_size
|
87
|
+
assert d.instance.buffer_config.flush_at_shutdown
|
88
|
+
assert_equal ['tag'], d.instance.buffer_config.chunk_keys
|
89
|
+
assert d.instance.chunk_key_tag
|
90
|
+
assert !d.instance.chunk_key_time
|
91
|
+
assert_equal [], d.instance.chunk_keys
|
92
|
+
end
|
93
|
+
|
94
|
+
test 'configure with output_type' do
|
95
|
+
d = create_driver(config_element("ROOT", "", {"output_type" => "json"}, [config_element("buffer")]))
|
96
|
+
assert_equal 'json', d.instance.formatter_configs.first[:@type]
|
97
|
+
|
98
|
+
d = create_driver(config_element("ROOT", "", {"output_type" => "hash"}, [config_element("buffer")]))
|
99
|
+
assert_equal 'hash', d.instance.formatter_configs.first[:@type]
|
100
|
+
|
101
|
+
assert_raise(Fluent::ConfigError) do
|
102
|
+
create_driver(config_element("ROOT", "", {"output_type" => "foo"}, [config_element("buffer")]))
|
71
103
|
end
|
72
104
|
end
|
73
|
-
assert_equal "#{Time.at(time).localtime} test: {\"test\"=>\"test2\"}\n", out
|
74
105
|
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
106
|
+
sub_test_case "emit with default config" do
|
107
|
+
test '#write(synchronous)' do
|
108
|
+
d = create_driver(config_element("ROOT", "", {}, [config_element("buffer")]))
|
109
|
+
time = event_time()
|
110
|
+
|
111
|
+
out = capture_log do
|
112
|
+
d.run(default_tag: 'test', flush: true) do
|
113
|
+
d.feed(time, {'test' => 'test'})
|
114
|
+
end
|
115
|
+
end
|
116
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test\"}\n", out
|
117
|
+
end
|
118
|
+
end
|
79
119
|
|
80
|
-
|
120
|
+
sub_test_case "emit json" do
|
121
|
+
data('oj' => 'oj', 'yajl' => 'yajl')
|
122
|
+
test '#write(synchronous)' do |data|
|
123
|
+
d = create_driver(config_element("ROOT", "", {"output_type" => "json", "json_parser" => data}, [config_element("buffer")]))
|
124
|
+
time = event_time()
|
125
|
+
|
126
|
+
out = capture_log do
|
127
|
+
d.run(default_tag: 'test', flush: true) do
|
128
|
+
d.feed(time, {'test' => 'test'})
|
129
|
+
end
|
130
|
+
end
|
131
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test\"}\n", out
|
132
|
+
end
|
133
|
+
|
134
|
+
data('oj' => 'oj', 'yajl' => 'yajl')
|
135
|
+
test '#try_write(asynchronous)' do |data|
|
136
|
+
d = create_driver(config_element("ROOT", "", {"output_type" => "json", "json_parser" => data}, [config_element("buffer")]))
|
137
|
+
time = event_time()
|
138
|
+
d.instance.delayed = true
|
139
|
+
|
140
|
+
out = capture_log do
|
141
|
+
d.run(default_tag: 'test', flush: true, shutdown: false) do
|
142
|
+
d.feed(time, {'test' => 'test'})
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
146
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\":\"test\"}\n", out
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
sub_test_case 'emit hash' do
|
151
|
+
test '#write(synchronous)' do
|
152
|
+
d = create_driver(config_element("ROOT", "", {"output_type" => "hash"}, [config_element("buffer")]))
|
153
|
+
time = event_time()
|
154
|
+
|
155
|
+
out = capture_log do
|
156
|
+
d.run(default_tag: 'test', flush: true) do
|
157
|
+
d.feed(time, {'test' => 'test'})
|
158
|
+
end
|
159
|
+
end
|
160
|
+
|
161
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\"=>\"test\"}\n", out
|
162
|
+
end
|
163
|
+
|
164
|
+
test '#try_write(asynchronous)' do
|
165
|
+
d = create_driver(config_element("ROOT", "", {"output_type" => "hash"}, [config_element("buffer")]))
|
166
|
+
time = event_time()
|
167
|
+
d.instance.delayed = true
|
168
|
+
|
169
|
+
out = capture_log do
|
170
|
+
d.run(default_tag: 'test', flush: true, shutdown: false) do
|
171
|
+
d.feed(time, {'test' => 'test'})
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
175
|
+
assert_equal "#{Time.at(time).localtime} test: {\"test\"=>\"test\"}\n", out
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
81
179
|
|
82
180
|
# Capture the log output of the block given
|
83
181
|
def capture_log(&block)
|
data/test/test_root_agent.rb
CHANGED
@@ -47,6 +47,48 @@ class RootAgentTest < ::Test::Unit::TestCase
|
|
47
47
|
assert_nil ra.error_collector
|
48
48
|
end
|
49
49
|
|
50
|
+
test 'raises configuration error for missing type of source' do
|
51
|
+
conf = <<-EOC
|
52
|
+
<source>
|
53
|
+
</source>
|
54
|
+
EOC
|
55
|
+
errmsg = "Missing '@type' parameter on <source> directive"
|
56
|
+
assert_raise Fluent::ConfigError.new(errmsg) do
|
57
|
+
configure_ra(conf)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
test 'raises configuration error for missing type of match' do
|
62
|
+
conf = <<-EOC
|
63
|
+
<source>
|
64
|
+
@type test_in
|
65
|
+
</source>
|
66
|
+
<match *.**>
|
67
|
+
</match>
|
68
|
+
EOC
|
69
|
+
errmsg = "Missing '@type' parameter on <match> directive"
|
70
|
+
assert_raise Fluent::ConfigError.new(errmsg) do
|
71
|
+
configure_ra(conf)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
test 'raises configuration error for missing type of filter' do
|
76
|
+
conf = <<-EOC
|
77
|
+
<source>
|
78
|
+
@type test_in
|
79
|
+
</source>
|
80
|
+
<filter *.**>
|
81
|
+
</filter>
|
82
|
+
<match *.**>
|
83
|
+
@type test_out
|
84
|
+
</match>
|
85
|
+
EOC
|
86
|
+
errmsg = "Missing '@type' parameter on <filter> directive"
|
87
|
+
assert_raise Fluent::ConfigError.new(errmsg) do
|
88
|
+
configure_ra(conf)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
50
92
|
test 'with plugins' do
|
51
93
|
# check @type and type in one configuration
|
52
94
|
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: 0.14.
|
4
|
+
version: 0.14.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sadayuki Furuhashi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-09-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: msgpack
|
@@ -305,6 +305,9 @@ files:
|
|
305
305
|
- example/copy_roundrobin.conf
|
306
306
|
- example/filter_stdout.conf
|
307
307
|
- example/in_forward.conf
|
308
|
+
- example/in_forward_client.conf
|
309
|
+
- example/in_forward_shared_key.conf
|
310
|
+
- example/in_forward_users.conf
|
308
311
|
- example/in_http.conf
|
309
312
|
- example/in_out_forward.conf
|
310
313
|
- example/in_syslog.conf
|
@@ -312,11 +315,15 @@ files:
|
|
312
315
|
- example/in_tcp.conf
|
313
316
|
- example/in_udp.conf
|
314
317
|
- example/multi_filters.conf
|
315
|
-
- example/out_buffered_null.conf
|
316
318
|
- example/out_copy.conf
|
317
319
|
- example/out_file.conf
|
318
320
|
- example/out_forward.conf
|
319
321
|
- example/out_forward_buf_file.conf
|
322
|
+
- example/out_forward_client.conf
|
323
|
+
- example/out_forward_shared_key.conf
|
324
|
+
- example/out_forward_users.conf
|
325
|
+
- example/out_null.conf
|
326
|
+
- example/secondary_file.conf
|
320
327
|
- example/v0_12_filter.conf
|
321
328
|
- example/v1_literal_example.conf
|
322
329
|
- fluent.conf
|
@@ -416,8 +423,6 @@ files:
|
|
416
423
|
- lib/fluent/plugin/in_unix.rb
|
417
424
|
- lib/fluent/plugin/input.rb
|
418
425
|
- lib/fluent/plugin/multi_output.rb
|
419
|
-
- lib/fluent/plugin/out_buffered_null.rb
|
420
|
-
- lib/fluent/plugin/out_buffered_stdout.rb
|
421
426
|
- lib/fluent/plugin/out_copy.rb
|
422
427
|
- lib/fluent/plugin/out_exec.rb
|
423
428
|
- lib/fluent/plugin/out_exec_filter.rb
|
@@ -426,6 +431,7 @@ files:
|
|
426
431
|
- lib/fluent/plugin/out_null.rb
|
427
432
|
- lib/fluent/plugin/out_relabel.rb
|
428
433
|
- lib/fluent/plugin/out_roundrobin.rb
|
434
|
+
- lib/fluent/plugin/out_secondary_file.rb
|
429
435
|
- lib/fluent/plugin/out_stdout.rb
|
430
436
|
- lib/fluent/plugin/out_stream.rb
|
431
437
|
- lib/fluent/plugin/output.rb
|
@@ -486,6 +492,7 @@ files:
|
|
486
492
|
- lib/fluent/test/log.rb
|
487
493
|
- lib/fluent/test/output_test.rb
|
488
494
|
- lib/fluent/test/parser_test.rb
|
495
|
+
- lib/fluent/test/startup_shutdown.rb
|
489
496
|
- lib/fluent/time.rb
|
490
497
|
- lib/fluent/timezone.rb
|
491
498
|
- lib/fluent/unique_id.rb
|
@@ -544,8 +551,6 @@ files:
|
|
544
551
|
- test/plugin/test_in_unix.rb
|
545
552
|
- test/plugin/test_input.rb
|
546
553
|
- test/plugin/test_multi_output.rb
|
547
|
-
- test/plugin/test_out_buffered_null.rb
|
548
|
-
- test/plugin/test_out_buffered_stdout.rb
|
549
554
|
- test/plugin/test_out_copy.rb
|
550
555
|
- test/plugin/test_out_exec.rb
|
551
556
|
- test/plugin/test_out_exec_filter.rb
|
@@ -554,6 +559,7 @@ files:
|
|
554
559
|
- test/plugin/test_out_null.rb
|
555
560
|
- test/plugin/test_out_relabel.rb
|
556
561
|
- test/plugin/test_out_roundrobin.rb
|
562
|
+
- test/plugin/test_out_secondary_file.rb
|
557
563
|
- test/plugin/test_out_stdout.rb
|
558
564
|
- test/plugin/test_out_stream.rb
|
559
565
|
- test/plugin/test_output.rb
|
@@ -693,8 +699,6 @@ test_files:
|
|
693
699
|
- test/plugin/test_in_unix.rb
|
694
700
|
- test/plugin/test_input.rb
|
695
701
|
- test/plugin/test_multi_output.rb
|
696
|
-
- test/plugin/test_out_buffered_null.rb
|
697
|
-
- test/plugin/test_out_buffered_stdout.rb
|
698
702
|
- test/plugin/test_out_copy.rb
|
699
703
|
- test/plugin/test_out_exec.rb
|
700
704
|
- test/plugin/test_out_exec_filter.rb
|
@@ -703,6 +707,7 @@ test_files:
|
|
703
707
|
- test/plugin/test_out_null.rb
|
704
708
|
- test/plugin/test_out_relabel.rb
|
705
709
|
- test/plugin/test_out_roundrobin.rb
|
710
|
+
- test/plugin/test_out_secondary_file.rb
|
706
711
|
- test/plugin/test_out_stdout.rb
|
707
712
|
- test/plugin/test_out_stream.rb
|
708
713
|
- test/plugin/test_output.rb
|
@@ -1,59 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Fluentd
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
require 'fluent/plugin/output'
|
18
|
-
|
19
|
-
module Fluent::Plugin
|
20
|
-
class BufferedNullOutput < Output
|
21
|
-
# This plugin is for tests of buffer plugins
|
22
|
-
|
23
|
-
Fluent::Plugin.register_output('buffered_null', self)
|
24
|
-
|
25
|
-
config_section :buffer do
|
26
|
-
config_set_default :chunk_keys, ['tag']
|
27
|
-
config_set_default :flush_at_shutdown, true
|
28
|
-
config_set_default :chunk_limit_size, 10 * 1024
|
29
|
-
end
|
30
|
-
|
31
|
-
attr_accessor :feed_proc, :delayed
|
32
|
-
|
33
|
-
def initialize
|
34
|
-
super
|
35
|
-
@delayed = false
|
36
|
-
@feed_proc = nil
|
37
|
-
end
|
38
|
-
|
39
|
-
def prefer_delayed_commit
|
40
|
-
@delayed
|
41
|
-
end
|
42
|
-
|
43
|
-
def write(chunk)
|
44
|
-
if @feed_proc
|
45
|
-
@feed_proc.call(chunk)
|
46
|
-
else
|
47
|
-
# ignore chunk.read
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
def try_write(chunk)
|
52
|
-
if @feed_proc
|
53
|
-
@feed_proc.call(chunk)
|
54
|
-
else
|
55
|
-
# ignore chunk.read
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# Fluentd
|
3
|
-
#
|
4
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
-
# you may not use this file except in compliance with the License.
|
6
|
-
# You may obtain a copy of the License at
|
7
|
-
#
|
8
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
-
#
|
10
|
-
# Unless required by applicable law or agreed to in writing, software
|
11
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
-
# See the License for the specific language governing permissions and
|
14
|
-
# limitations under the License.
|
15
|
-
#
|
16
|
-
|
17
|
-
require 'fluent/plugin/output'
|
18
|
-
|
19
|
-
module Fluent::Plugin
|
20
|
-
class BufferedStdoutOutput < Output
|
21
|
-
Fluent::Plugin.register_output('buffered_stdout', self)
|
22
|
-
|
23
|
-
helpers :formatter, :inject, :compat_parameters
|
24
|
-
|
25
|
-
config_section :buffer do
|
26
|
-
config_set_default :chunk_keys, ['tag']
|
27
|
-
config_set_default :flush_at_shutdown, true
|
28
|
-
config_set_default :chunk_limit_size, 10 * 1024
|
29
|
-
end
|
30
|
-
|
31
|
-
DEFAULT_FORMAT_TYPE = 'json'
|
32
|
-
|
33
|
-
config_section :format do
|
34
|
-
config_set_default :@type, DEFAULT_FORMAT_TYPE
|
35
|
-
end
|
36
|
-
|
37
|
-
attr_accessor :delayed
|
38
|
-
|
39
|
-
def initialize
|
40
|
-
super
|
41
|
-
@delayed = false
|
42
|
-
end
|
43
|
-
|
44
|
-
def prefer_delayed_commit
|
45
|
-
@delayed
|
46
|
-
end
|
47
|
-
|
48
|
-
def configure(conf)
|
49
|
-
if conf['output_type'] && !conf['format']
|
50
|
-
conf['format'] = conf['output_type']
|
51
|
-
end
|
52
|
-
compat_parameters_convert(conf, :inject, :formatter)
|
53
|
-
super
|
54
|
-
@formatter = formatter_create(conf: conf.elements('format').first, default_type: DEFAULT_FORMAT_TYPE)
|
55
|
-
end
|
56
|
-
|
57
|
-
def write(chunk)
|
58
|
-
chunk.write_to($log)
|
59
|
-
end
|
60
|
-
|
61
|
-
def try_write(chunk)
|
62
|
-
chunk.write_to($log)
|
63
|
-
end
|
64
|
-
|
65
|
-
def format(tag, time, record)
|
66
|
-
record = inject_values_to_record(tag, time, record)
|
67
|
-
"#{Time.at(time).localtime} #{tag}: #{@formatter.format(tag, time, record).chomp}\n"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|