fluentd 0.14.6 → 0.14.7
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 +46 -0
- data/bin/fluent-binlog-reader +7 -0
- data/example/in_dummy_with_compression.conf +23 -0
- data/lib/fluent/agent.rb +8 -12
- data/lib/fluent/command/binlog_reader.rb +234 -0
- data/lib/fluent/command/fluentd.rb +17 -1
- data/lib/fluent/compat/file_util.rb +1 -1
- data/lib/fluent/compat/output.rb +5 -1
- data/lib/fluent/config/configure_proxy.rb +18 -4
- data/lib/fluent/config/element.rb +1 -1
- data/lib/fluent/config/section.rb +1 -1
- data/lib/fluent/config/v1_parser.rb +1 -1
- data/lib/fluent/env.rb +1 -0
- data/lib/fluent/event.rb +49 -2
- data/lib/fluent/event_router.rb +6 -2
- data/lib/fluent/label.rb +8 -0
- data/lib/fluent/log.rb +30 -1
- data/lib/fluent/plugin.rb +1 -1
- data/lib/fluent/plugin/base.rb +3 -0
- data/lib/fluent/plugin/buf_file.rb +2 -2
- data/lib/fluent/plugin/buf_memory.rb +1 -1
- data/lib/fluent/plugin/buffer.rb +12 -2
- data/lib/fluent/plugin/buffer/chunk.rb +68 -7
- data/lib/fluent/plugin/buffer/file_chunk.rb +4 -4
- data/lib/fluent/plugin/buffer/memory_chunk.rb +4 -4
- data/lib/fluent/plugin/compressable.rb +91 -0
- data/lib/fluent/plugin/filter_grep.rb +4 -4
- data/lib/fluent/plugin/formatter.rb +2 -2
- data/lib/fluent/plugin/formatter_json.rb +2 -1
- data/lib/fluent/plugin/formatter_out_file.rb +3 -30
- data/lib/fluent/plugin/in_forward.rb +3 -2
- data/lib/fluent/plugin/in_monitor_agent.rb +7 -21
- data/lib/fluent/plugin/in_syslog.rb +1 -1
- data/lib/fluent/plugin/in_tail.rb +10 -2
- data/lib/fluent/plugin/multi_output.rb +63 -3
- data/lib/fluent/plugin/out_exec.rb +1 -1
- data/lib/fluent/plugin/out_file.rb +5 -1
- data/lib/fluent/plugin/out_forward.rb +17 -5
- data/lib/fluent/plugin/out_stdout.rb +2 -1
- data/lib/fluent/plugin/output.rb +205 -19
- data/lib/fluent/plugin/parser.rb +5 -49
- data/lib/fluent/plugin/parser_apache2.rb +1 -1
- data/lib/fluent/plugin/parser_json.rb +4 -4
- data/lib/fluent/plugin/parser_multiline.rb +5 -5
- data/lib/fluent/plugin/parser_regexp.rb +1 -2
- data/lib/fluent/plugin/parser_syslog.rb +2 -2
- data/lib/fluent/plugin/storage_local.rb +2 -1
- data/lib/fluent/plugin_helper.rb +1 -0
- data/lib/fluent/plugin_helper/compat_parameters.rb +39 -21
- data/lib/fluent/plugin_helper/extract.rb +92 -0
- data/lib/fluent/plugin_helper/inject.rb +10 -12
- data/lib/fluent/plugin_helper/thread.rb +23 -3
- data/lib/fluent/registry.rb +1 -1
- data/lib/fluent/root_agent.rb +2 -1
- data/lib/fluent/supervisor.rb +28 -8
- data/lib/fluent/test/base.rb +0 -7
- data/lib/fluent/test/driver/base.rb +1 -0
- data/lib/fluent/test/driver/output.rb +3 -0
- data/lib/fluent/test/helpers.rb +18 -0
- data/lib/fluent/test/input_test.rb +4 -2
- data/lib/fluent/test/log.rb +3 -1
- data/lib/fluent/time.rb +232 -1
- data/lib/fluent/timezone.rb +1 -1
- data/lib/fluent/version.rb +1 -1
- data/test/command/test_binlog_reader.rb +351 -0
- data/test/config/test_config_parser.rb +6 -0
- data/test/config/test_configurable.rb +47 -1
- data/test/helper.rb +0 -1
- data/test/plugin/test_buffer.rb +22 -2
- data/test/plugin/test_buffer_chunk.rb +34 -4
- data/test/plugin/test_buffer_file_chunk.rb +73 -0
- data/test/plugin/test_buffer_memory_chunk.rb +73 -0
- data/test/plugin/test_compressable.rb +81 -0
- data/test/plugin/test_formatter_json.rb +14 -1
- data/test/plugin/test_in_forward.rb +67 -3
- data/test/plugin/test_in_monitor_agent.rb +17 -1
- data/test/plugin/test_in_tail.rb +8 -8
- data/test/plugin/test_out_file.rb +0 -8
- data/test/plugin/test_out_forward.rb +85 -0
- data/test/plugin/test_out_secondary_file.rb +20 -12
- data/test/plugin/test_out_stdout.rb +11 -10
- data/test/plugin/test_output.rb +234 -0
- data/test/plugin/test_output_as_buffered.rb +223 -0
- data/test/plugin/test_output_as_buffered_compress.rb +165 -0
- data/test/plugin/test_parser_json.rb +8 -0
- data/test/plugin/test_parser_regexp.rb +1 -1
- data/test/plugin_helper/test_child_process.rb +2 -2
- data/test/plugin_helper/test_extract.rb +195 -0
- data/test/plugin_helper/test_inject.rb +0 -7
- data/test/scripts/fluent/plugin/formatter1/formatter_test1.rb +7 -0
- data/test/scripts/fluent/plugin/formatter2/formatter_test2.rb +7 -0
- data/test/test_event.rb +186 -0
- data/test/test_event_router.rb +1 -1
- data/test/test_formatter.rb +0 -7
- data/test/test_log.rb +121 -0
- data/test/test_plugin_classes.rb +62 -0
- data/test/test_root_agent.rb +125 -0
- data/test/test_supervisor.rb +25 -2
- data/test/test_time_formatter.rb +103 -7
- data/test/test_time_parser.rb +211 -0
- metadata +23 -4
- data/test/plugin/test_parser_time.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f99bac7f1329f22434907c02e8d382ca2774988e
|
4
|
+
data.tar.gz: fe3cb1733cc27f065397c5135f4f3c579dec81fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc21095fbec80e1ff718ef9179f84081a20d4688b33ee2f7b81821f56501cd5f3645dab77bb6ef98ad175118b5825d1e3ba261ed9baa19ab93214145a515472b
|
7
|
+
data.tar.gz: e2d3978c237c3101ce10146b2afe7ad5f8ffaf180c6d49c5f97cc483e6169ecc2802a2944647b25183cf4dbf81879704a0f61dffab0ac7cdd5b4488269cc30bf
|
data/ChangeLog
CHANGED
@@ -1,5 +1,51 @@
|
|
1
1
|
# v0.14
|
2
2
|
|
3
|
+
## Release v0.14.7 - 2016/10/07
|
4
|
+
|
5
|
+
### New features / Enhancement
|
6
|
+
|
7
|
+
* in_forward: support to transfer compressed data
|
8
|
+
https://github.com/fluent/fluentd/pull/1179
|
9
|
+
* out_stdout: fix to show nanosecond resolution time
|
10
|
+
https://github.com/fluent/fluentd/pull/1249
|
11
|
+
* Add option to rotate Fluentd daemon's log
|
12
|
+
https://github.com/fluent/fluentd/pull/1235
|
13
|
+
* Add a feature to parse/format numeric time (unix time [+ subsecond value])
|
14
|
+
https://github.com/fluent/fluentd/pull/1254
|
15
|
+
* Raise configuration errors for inconsistent <label> configurations
|
16
|
+
https://github.com/fluent/fluentd/pull/1233
|
17
|
+
* Fix to instantiate an unconfigured section even for multi: true
|
18
|
+
https://github.com/fluent/fluentd/pull/1210
|
19
|
+
* Add validators of placeholders for buffering key extraction
|
20
|
+
https://github.com/fluent/fluentd/pull/1255
|
21
|
+
* Fix to show log messages about filter optimization only when needed
|
22
|
+
https://github.com/fluent/fluentd/pull/1227
|
23
|
+
* Add some features to write plugins more easily
|
24
|
+
https://github.com/fluent/fluentd/pull/1256
|
25
|
+
|
26
|
+
### Bug fixes
|
27
|
+
|
28
|
+
* Fix Oj's default option to encode/decode JSON in the same way with Yajl
|
29
|
+
https://github.com/fluent/fluentd/pull/1147
|
30
|
+
https://github.com/fluent/fluentd/pull/1239
|
31
|
+
* Fix to raise correct configuration errors
|
32
|
+
https://github.com/fluent/fluentd/pull/1223
|
33
|
+
* Fix a bug to call `shutdown` method (and some others) twice
|
34
|
+
https://github.com/fluent/fluentd/pull/1242
|
35
|
+
* Fix to enable `chunk.each` only when it's encoded by msgpack
|
36
|
+
https://github.com/fluent/fluentd/pull/1263
|
37
|
+
* Fix a bug not to stop enqueue/flush threads correctly
|
38
|
+
https://github.com/fluent/fluentd/pull/1264
|
39
|
+
* out_forward: fix a bug that UDP heartbeat doesn't work
|
40
|
+
https://github.com/fluent/fluentd/pull/1238
|
41
|
+
* out_file: fix a crash bug when v0.14 enables symlink and resumes existing buffer file chunk generated by v0.12
|
42
|
+
https://github.com/fluent/fluentd/pull/1234
|
43
|
+
* in_monitor_agent: fix compatibility problem between outputs of v0.12 and v0.14
|
44
|
+
https://github.com/fluent/fluentd/pull/1232
|
45
|
+
* in_tail: fix a bug to crash to read large amount logs
|
46
|
+
https://github.com/fluent/fluentd/pull/1259
|
47
|
+
https://github.com/fluent/fluentd/pull/1261
|
48
|
+
|
3
49
|
## Release v0.14.6 - 2016/09/07
|
4
50
|
|
5
51
|
### Bug fixes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<source>
|
2
|
+
@type dummy
|
3
|
+
@label @main
|
4
|
+
tag "test.data"
|
5
|
+
size 2
|
6
|
+
rate 10
|
7
|
+
dummy {"message":"yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay"}
|
8
|
+
auto_increment_key number
|
9
|
+
</source>
|
10
|
+
|
11
|
+
<label @main>
|
12
|
+
<match test.data>
|
13
|
+
@type buffered_stdout
|
14
|
+
<buffer>
|
15
|
+
@type file
|
16
|
+
path "#{Dir.pwd}/compressed_buffers"
|
17
|
+
flush_at_shutdown false
|
18
|
+
chunk_limit_size 1m
|
19
|
+
flush_interval 10s
|
20
|
+
compress gzip
|
21
|
+
</buffer>
|
22
|
+
</match>
|
23
|
+
</label>
|
data/lib/fluent/agent.rb
CHANGED
@@ -86,21 +86,12 @@ module Fluent
|
|
86
86
|
lifecycle_control_list[:input] << i
|
87
87
|
end
|
88
88
|
end
|
89
|
-
|
89
|
+
outputs.each do |o|
|
90
90
|
if o.has_router?
|
91
91
|
lifecycle_control_list[:output_with_router] << o
|
92
92
|
else
|
93
93
|
lifecycle_control_list[:output] << o
|
94
94
|
end
|
95
|
-
|
96
|
-
if o.respond_to?(:outputs)
|
97
|
-
o.outputs.each do |store|
|
98
|
-
recursive_output_traverse.call(store)
|
99
|
-
end
|
100
|
-
end
|
101
|
-
}
|
102
|
-
outputs.each do |o|
|
103
|
-
recursive_output_traverse.call(o)
|
104
95
|
end
|
105
96
|
filters.each do |f|
|
106
97
|
lifecycle_control_list[:filter] << f
|
@@ -135,9 +126,14 @@ module Fluent
|
|
135
126
|
output.router = @event_router if output.respond_to?(:router=)
|
136
127
|
output.configure(conf)
|
137
128
|
@outputs << output
|
138
|
-
if output.respond_to?(:outputs) &&
|
129
|
+
if output.respond_to?(:outputs) && output.respond_to?(:multi_output?) && output.multi_output?
|
139
130
|
# TODO: ruby 2.3 or later: replace `output.respond_to?(:multi_output?) && output.multi_output?` with output&.multi_output?
|
140
|
-
|
131
|
+
outputs = if output.respond_to?(:static_outputs)
|
132
|
+
output.static_outputs
|
133
|
+
else
|
134
|
+
output.outputs
|
135
|
+
end
|
136
|
+
@outputs.push(*outputs)
|
141
137
|
end
|
142
138
|
@event_router.add_rule(pattern, output)
|
143
139
|
|
@@ -0,0 +1,234 @@
|
|
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 'optparse'
|
18
|
+
require 'msgpack'
|
19
|
+
|
20
|
+
require 'fluent/msgpack_factory'
|
21
|
+
require 'fluent/formatter'
|
22
|
+
require 'fluent/plugin'
|
23
|
+
require 'fluent/config/element'
|
24
|
+
|
25
|
+
class FluentBinlogReader
|
26
|
+
SUBCOMMAND = %w(cat head formats)
|
27
|
+
HELP_TEXT = <<HELP
|
28
|
+
Usage: fluent-binlog-reader <command> [<args>]
|
29
|
+
|
30
|
+
Commands of fluent-binlog-reader:
|
31
|
+
cat : Read files sequentially, writing them to standard output.
|
32
|
+
head : Display the beginning of a text file.
|
33
|
+
format : Display plugins that you can use.
|
34
|
+
|
35
|
+
See 'fluent-binlog-reader <command> --help' for more information on a specific command.
|
36
|
+
HELP
|
37
|
+
|
38
|
+
def initialize(argv = ARGV)
|
39
|
+
@argv = argv
|
40
|
+
end
|
41
|
+
|
42
|
+
def call
|
43
|
+
command_class = BinlogReaderCommand.const_get(command)
|
44
|
+
command_class.new(@argv).call
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def command
|
50
|
+
command = @argv.shift
|
51
|
+
if !command || !SUBCOMMAND.include?(command)
|
52
|
+
usage "Required subcommand : #{SUBCOMMAND.join(' | ')}"
|
53
|
+
end
|
54
|
+
|
55
|
+
command.split('_').map(&:capitalize).join('')
|
56
|
+
end
|
57
|
+
|
58
|
+
def usage(msg = nil)
|
59
|
+
puts HELP_TEXT
|
60
|
+
puts "Error: #{msg}" if msg
|
61
|
+
exit 1
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
module BinlogReaderCommand
|
66
|
+
class Base
|
67
|
+
def initialize(argv = ARGV)
|
68
|
+
@argv = argv
|
69
|
+
|
70
|
+
@options = { plugin: [] }
|
71
|
+
@opt_parser = OptionParser.new do |opt|
|
72
|
+
opt.separator 'Options:'
|
73
|
+
|
74
|
+
opt.on('-p DIR', '--plugin', 'add library directory path') do |v|
|
75
|
+
@options[:plugin] << v
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def call
|
81
|
+
raise NotImplementedError, 'BUG: command MUST implement this method'
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def usage(msg = nil)
|
87
|
+
puts @opt_parser.to_s
|
88
|
+
puts "Error: #{msg}" if msg
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
|
92
|
+
def parse_options!
|
93
|
+
@opt_parser.parse!(@argv)
|
94
|
+
|
95
|
+
unless @options[:plugin].empty?
|
96
|
+
if dir = @options[:plugin].find { |d| !Dir.exist?(d) }
|
97
|
+
usage "Directory #{dir} doesn't exist"
|
98
|
+
else
|
99
|
+
@options[:plugin].each do |d|
|
100
|
+
Fluent::Plugin.add_plugin_dir(d)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
rescue => e
|
105
|
+
usage e
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
module Formattable
|
110
|
+
DEFAULT_OPTIONS = {
|
111
|
+
format: :out_file
|
112
|
+
}
|
113
|
+
|
114
|
+
def initialize(argv = ARGV)
|
115
|
+
super
|
116
|
+
@options.merge!(DEFAULT_OPTIONS)
|
117
|
+
configure_option_parser
|
118
|
+
end
|
119
|
+
|
120
|
+
private
|
121
|
+
|
122
|
+
def configure_option_parser
|
123
|
+
@options.merge!(config_params: {})
|
124
|
+
|
125
|
+
@opt_parser.banner = "Usage: fluent-binlog-reader #{self.class.to_s.split('::').last.downcase} [options] file"
|
126
|
+
|
127
|
+
@opt_parser.on('-f TYPE', '--format', 'configure output format') do |v|
|
128
|
+
@options[:format] = v.to_sym
|
129
|
+
end
|
130
|
+
|
131
|
+
@opt_parser.on('-e KEY=VALUE', 'configure formatter config params') do |v|
|
132
|
+
key, value = v.split('=')
|
133
|
+
usage "#{v} is invalid. valid format is like `key=value`" unless value
|
134
|
+
@options[:config_params].merge!(key => value)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def lookup_formatter(format, params)
|
139
|
+
conf = Fluent::Config::Element.new('ROOT', '', params, [])
|
140
|
+
formatter = Fluent::Plugin.new_formatter(format)
|
141
|
+
|
142
|
+
if formatter.respond_to?(:configure)
|
143
|
+
formatter.configure(conf)
|
144
|
+
end
|
145
|
+
formatter
|
146
|
+
rescue => e
|
147
|
+
usage e
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
class Head < Base
|
152
|
+
include Formattable
|
153
|
+
|
154
|
+
DEFAULT_HEAD_OPTIONS = {
|
155
|
+
count: 5
|
156
|
+
}
|
157
|
+
|
158
|
+
def initialize(argv = ARGV)
|
159
|
+
super
|
160
|
+
@options.merge!(default_options)
|
161
|
+
parse_options!
|
162
|
+
end
|
163
|
+
|
164
|
+
def call
|
165
|
+
@formatter = lookup_formatter(@options[:format], @options[:config_params])
|
166
|
+
|
167
|
+
File.open(@path, 'r') do |io|
|
168
|
+
i = 1
|
169
|
+
Fluent::MessagePackFactory.unpacker(io).each do |(time, record)|
|
170
|
+
print @formatter.format(@path, time, record) # path is used for tag
|
171
|
+
break if @options[:count] && i == @options[:count]
|
172
|
+
i += 1
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
private
|
178
|
+
|
179
|
+
def default_options
|
180
|
+
DEFAULT_HEAD_OPTIONS
|
181
|
+
end
|
182
|
+
|
183
|
+
def parse_options!
|
184
|
+
@opt_parser.on('-n COUNT', 'Set the number of lines to display') do |v|
|
185
|
+
@options[:count] = v.to_i
|
186
|
+
usage "illegal line count -- #{@options[:count]}" if @options[:count] < 1
|
187
|
+
end
|
188
|
+
|
189
|
+
super
|
190
|
+
|
191
|
+
usage 'Path is required' if @argv.empty?
|
192
|
+
@path = @argv.first
|
193
|
+
usage "#{@path} is not found" unless File.exist?(@path)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
class Cat < Head
|
198
|
+
DEFAULT_CAT_OPTIONS = {
|
199
|
+
count: nil # Overwrite DEFAULT_HEAD_OPTIONS[:count]
|
200
|
+
}
|
201
|
+
|
202
|
+
def default_options
|
203
|
+
DEFAULT_CAT_OPTIONS
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
class Formats < Base
|
208
|
+
def initialize(argv = ARGV)
|
209
|
+
super
|
210
|
+
parse_options!
|
211
|
+
end
|
212
|
+
|
213
|
+
def call
|
214
|
+
prefix = Fluent::Plugin::FORMATTER_REGISTRY.dir_search_prefix || 'formatter_'
|
215
|
+
|
216
|
+
plugin_dirs = @options[:plugin]
|
217
|
+
unless plugin_dirs.empty?
|
218
|
+
plugin_dirs.each do |d|
|
219
|
+
Dir.glob("#{d}/#{prefix}*.rb").each do |path|
|
220
|
+
require File.absolute_path(path)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
$LOAD_PATH.map do |lp|
|
226
|
+
Dir.glob("#{lp}/#{prefix}*.rb").each do |path|
|
227
|
+
require path
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
puts Fluent::Plugin::FORMATTER_REGISTRY.map.keys
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|
@@ -81,6 +81,23 @@ op.on('-o', '--log PATH', "log file path") {|s|
|
|
81
81
|
opts[:log_path] = s
|
82
82
|
}
|
83
83
|
|
84
|
+
ROTATE_AGE = %w(daily weekly monthly)
|
85
|
+
op.on('--log-rotate-age AGE', 'generations to keep rotated log files') {|age|
|
86
|
+
if ROTATE_AGE.include?(age)
|
87
|
+
opts[:log_rotate_age] = age
|
88
|
+
else
|
89
|
+
begin
|
90
|
+
opts[:log_rotate_age] = Integer(age)
|
91
|
+
rescue TypeError
|
92
|
+
usage "log-rotate-age should be #{rotate_ages.join(', ')} or a number"
|
93
|
+
end
|
94
|
+
end
|
95
|
+
}
|
96
|
+
|
97
|
+
op.on('--log-rotate-size BYTES', 'sets the byte size to rotate log files') {|s|
|
98
|
+
opts[:log_rotate_size] = s.to_i
|
99
|
+
}
|
100
|
+
|
84
101
|
op.on('-i', '--inline-config CONFIG_STRING', "inline config which is appended to the config file on-the-fly") {|s|
|
85
102
|
opts[:inline_config] = s
|
86
103
|
}
|
@@ -270,4 +287,3 @@ if opts[:supervise]
|
|
270
287
|
else
|
271
288
|
Fluent::Supervisor.new(opts).run_worker
|
272
289
|
end
|
273
|
-
|
@@ -32,7 +32,7 @@ module Fluent
|
|
32
32
|
end
|
33
33
|
module_function :writable?
|
34
34
|
|
35
|
-
# Check file is writable in conjunction
|
35
|
+
# Check file is writable in conjunction with mkdir_p(dirname(path))
|
36
36
|
#
|
37
37
|
# @param [String] path File path
|
38
38
|
# @return [Boolean] file writable or not
|
data/lib/fluent/compat/output.rb
CHANGED
@@ -488,7 +488,11 @@ module Fluent
|
|
488
488
|
end
|
489
489
|
|
490
490
|
def format_stream(tag, es) # for BufferedOutputTestDriver
|
491
|
-
|
491
|
+
if @compress == :gzip
|
492
|
+
es.to_compressed_msgpack_stream(time_int: @time_as_integer)
|
493
|
+
else
|
494
|
+
es.to_msgpack_stream(time_int: @time_as_integer)
|
495
|
+
end
|
492
496
|
end
|
493
497
|
|
494
498
|
def write(chunk)
|
@@ -208,9 +208,21 @@ module Fluent
|
|
208
208
|
end
|
209
209
|
end
|
210
210
|
|
211
|
-
def option_value_type!(name, opts, key, klass)
|
212
|
-
if opts.has_key?(key)
|
213
|
-
|
211
|
+
def option_value_type!(name, opts, key, klass=nil, type: nil)
|
212
|
+
if opts.has_key?(key)
|
213
|
+
if klass && !opts[key].is_a?(klass)
|
214
|
+
raise ArgumentError, "#{name}: #{key} must be a #{klass}, but #{opts[key].class}"
|
215
|
+
end
|
216
|
+
case type
|
217
|
+
when :boolean
|
218
|
+
unless opts[key].is_a?(TrueClass) || opts[key].is_a?(FalseClass)
|
219
|
+
raise ArgumentError, "#{name}: #{key} must be true or false, but #{opts[key].class}"
|
220
|
+
end
|
221
|
+
when nil
|
222
|
+
# ignore
|
223
|
+
else
|
224
|
+
raise "unknown type: #{type} for option #{key}"
|
225
|
+
end
|
214
226
|
end
|
215
227
|
end
|
216
228
|
|
@@ -233,9 +245,10 @@ module Fluent
|
|
233
245
|
raise ArgumentError, "#{name}: unknown config_argument type `#{type}'"
|
234
246
|
end
|
235
247
|
|
248
|
+
# options for config_param
|
236
249
|
option_value_type!(name, opts, :desc, String)
|
237
250
|
option_value_type!(name, opts, :alias, Symbol)
|
238
|
-
option_value_type!(name, opts, :secret,
|
251
|
+
option_value_type!(name, opts, :secret, type: :boolean)
|
239
252
|
option_value_type!(name, opts, :deprecated, String)
|
240
253
|
option_value_type!(name, opts, :obsoleted, String)
|
241
254
|
if type == :enum
|
@@ -244,6 +257,7 @@ module Fluent
|
|
244
257
|
end
|
245
258
|
end
|
246
259
|
option_value_type!(name, opts, :value_type, Symbol) # hash, array
|
260
|
+
option_value_type!(name, opts, :skip_accessor, type: :boolean)
|
247
261
|
|
248
262
|
if opts.has_key?(:default)
|
249
263
|
config_set_default(name, opts[:default])
|