fluentd 0.14.8 → 0.14.9
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/.gitignore +2 -0
- data/CONTRIBUTING.md +6 -1
- data/ChangeLog +38 -0
- data/Rakefile +21 -0
- data/example/out_exec_filter.conf +42 -0
- data/lib/fluent/agent.rb +2 -2
- data/lib/fluent/command/binlog_reader.rb +1 -1
- data/lib/fluent/command/cat.rb +5 -2
- data/lib/fluent/compat/output.rb +7 -8
- data/lib/fluent/compat/parser.rb +139 -11
- data/lib/fluent/config/configure_proxy.rb +2 -11
- data/lib/fluent/config/section.rb +7 -0
- data/lib/fluent/configurable.rb +1 -3
- data/lib/fluent/log.rb +1 -1
- data/lib/fluent/plugin/base.rb +17 -0
- data/lib/fluent/plugin/filter_parser.rb +108 -0
- data/lib/fluent/plugin/filter_record_transformer.rb +4 -7
- data/lib/fluent/plugin/filter_stdout.rb +1 -1
- data/lib/fluent/plugin/formatter.rb +5 -0
- data/lib/fluent/plugin/formatter_msgpack.rb +4 -0
- data/lib/fluent/plugin/formatter_stdout.rb +3 -2
- data/lib/fluent/plugin/formatter_tsv.rb +34 -0
- data/lib/fluent/plugin/in_exec.rb +48 -93
- data/lib/fluent/plugin/in_forward.rb +25 -105
- data/lib/fluent/plugin/in_http.rb +68 -65
- data/lib/fluent/plugin/in_syslog.rb +29 -51
- data/lib/fluent/plugin/multi_output.rb +1 -3
- data/lib/fluent/plugin/out_exec.rb +58 -71
- data/lib/fluent/plugin/out_exec_filter.rb +199 -279
- data/lib/fluent/plugin/out_file.rb +155 -80
- data/lib/fluent/plugin/out_forward.rb +44 -47
- data/lib/fluent/plugin/out_stdout.rb +6 -21
- data/lib/fluent/plugin/output.rb +23 -17
- data/lib/fluent/plugin/parser.rb +121 -61
- data/lib/fluent/plugin/parser_csv.rb +9 -3
- data/lib/fluent/plugin/parser_json.rb +37 -35
- data/lib/fluent/plugin/parser_ltsv.rb +11 -19
- data/lib/fluent/plugin/parser_msgpack.rb +50 -0
- data/lib/fluent/plugin/parser_regexp.rb +15 -42
- data/lib/fluent/plugin/parser_tsv.rb +8 -3
- data/lib/fluent/plugin_helper.rb +8 -1
- data/lib/fluent/plugin_helper/child_process.rb +139 -73
- data/lib/fluent/plugin_helper/compat_parameters.rb +93 -4
- data/lib/fluent/plugin_helper/event_emitter.rb +14 -1
- data/lib/fluent/plugin_helper/extract.rb +16 -4
- data/lib/fluent/plugin_helper/formatter.rb +9 -11
- data/lib/fluent/plugin_helper/inject.rb +4 -0
- data/lib/fluent/plugin_helper/parser.rb +3 -3
- data/lib/fluent/root_agent.rb +1 -1
- data/lib/fluent/test/driver/base.rb +51 -37
- data/lib/fluent/test/driver/base_owner.rb +18 -8
- data/lib/fluent/test/driver/multi_output.rb +2 -1
- data/lib/fluent/test/driver/output.rb +29 -6
- data/lib/fluent/test/helpers.rb +3 -1
- data/lib/fluent/test/log.rb +4 -0
- data/lib/fluent/test/startup_shutdown.rb +13 -0
- data/lib/fluent/time.rb +14 -8
- data/lib/fluent/version.rb +1 -1
- data/test/command/test_binlog_reader.rb +5 -1
- data/test/config/test_configurable.rb +173 -0
- data/test/config/test_configure_proxy.rb +0 -43
- data/test/plugin/test_base.rb +16 -0
- data/test/plugin/test_filter_parser.rb +665 -0
- data/test/plugin/test_filter_record_transformer.rb +11 -3
- data/test/plugin/test_filter_stdout.rb +18 -27
- data/test/plugin/test_in_dummy.rb +1 -1
- data/test/plugin/test_in_exec.rb +206 -94
- data/test/plugin/test_in_forward.rb +310 -327
- data/test/plugin/test_in_http.rb +310 -186
- data/test/plugin/test_out_exec.rb +223 -68
- data/test/plugin/test_out_exec_filter.rb +520 -169
- data/test/plugin/test_out_file.rb +620 -177
- data/test/plugin/test_out_forward.rb +110 -132
- data/test/plugin/test_out_null.rb +1 -1
- data/test/plugin/test_out_secondary_file.rb +4 -2
- data/test/plugin/test_out_stdout.rb +14 -35
- data/test/plugin/test_parser.rb +359 -0
- data/test/plugin/test_parser_csv.rb +1 -2
- data/test/plugin/test_parser_json.rb +3 -4
- data/test/plugin/test_parser_labeled_tsv.rb +1 -2
- data/test/plugin/test_parser_none.rb +1 -2
- data/test/plugin/test_parser_regexp.rb +8 -4
- data/test/plugin/test_parser_tsv.rb +4 -3
- data/test/plugin_helper/test_child_process.rb +184 -0
- data/test/plugin_helper/test_compat_parameters.rb +88 -1
- data/test/plugin_helper/test_extract.rb +0 -1
- data/test/plugin_helper/test_formatter.rb +5 -2
- data/test/plugin_helper/test_parser.rb +6 -5
- data/test/test_output.rb +24 -2
- data/test/test_plugin_classes.rb +20 -0
- data/test/test_root_agent.rb +139 -0
- data/test/test_test_drivers.rb +132 -0
- metadata +12 -4
- data/test/plugin/test_parser_base.rb +0 -32
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 22cf802055c4ce65d338d4ffdc223dfbd737d115
|
4
|
+
data.tar.gz: c7458bd96af9c44f679a501fbea6507c19d5a9e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 72db4f8537104b07b0f328e5cdb581601602b66ba8be885cb8288d9e96509e43524986c12d703556bfcb09c9a6a74f9be1b66144b8177c097882768798cac597
|
7
|
+
data.tar.gz: 21aae0faa3e878c709b5acac57d9920092e99542d09ee948f0cc84b8efb1d933914c9f84824624dff7dfe1177eaaa0918c75673b888112281e6887e928711ee6
|
data/.gitignore
CHANGED
data/CONTRIBUTING.md
CHANGED
@@ -7,8 +7,13 @@ We'd love your contribution. Here are the guidelines!
|
|
7
7
|
RESOURCES of [Official site](http://www.fluentd.org/) and [Fluentd documentation](http://docs.fluentd.org/) may help you.
|
8
8
|
|
9
9
|
If you have further questions about Fluentd and plugins, please direct these to [Mailing List](https://groups.google.com/forum/#!forum/fluentd).
|
10
|
+
Don't use Github issue for asking questions. Here are examples:
|
10
11
|
|
11
|
-
|
12
|
+
- I installed xxx plugin but it doesn't work. Why?
|
13
|
+
- Fluentd starts but logs are not sent to xxx. Am I wrong?
|
14
|
+
- I want to do xxx. How to realize it with plugins?
|
15
|
+
|
16
|
+
We may close such questions to keep clear repository for developers and users.
|
12
17
|
Github issue is mainly for submitting a bug report or feature request. See below.
|
13
18
|
|
14
19
|
## Found a bug?
|
data/ChangeLog
CHANGED
@@ -1,5 +1,43 @@
|
|
1
1
|
# v0.14
|
2
2
|
|
3
|
+
## Release v0.14.9 - 2016/11/15
|
4
|
+
|
5
|
+
### New features / Enhancement
|
6
|
+
|
7
|
+
* filter_parser: Port fluent-plugin-parser into built-in plugin
|
8
|
+
https://github.com/fluent/fluentd/pull/1191
|
9
|
+
* parser/formatter plugin helpers with default @type in plugin side
|
10
|
+
https://github.com/fluent/fluentd/pull/1267
|
11
|
+
* parser: Reconstruct Parser related classes
|
12
|
+
https://github.com/fluent/fluentd/pull/1286
|
13
|
+
* filter_record_transformer: Remove old behaviours
|
14
|
+
https://github.com/fluent/fluentd/pull/1311
|
15
|
+
* Migrate some built-in plugins into v0.14 API
|
16
|
+
https://github.com/fluent/fluentd/pull/1257 (out_file)
|
17
|
+
https://github.com/fluent/fluentd/pull/1297 (out_exec, out_exec_filter)
|
18
|
+
https://github.com/fluent/fluentd/pull/1306 (in_forward, out_forward)
|
19
|
+
https://github.com/fluent/fluentd/pull/1308 (in_http)
|
20
|
+
* test: Improve test drivers
|
21
|
+
https://github.com/fluent/fluentd/pull/1302
|
22
|
+
https://github.com/fluent/fluentd/pull/1305
|
23
|
+
|
24
|
+
### Bug fixes
|
25
|
+
|
26
|
+
* log: Avoid name conflict between Fluent::Logger
|
27
|
+
https://github.com/fluent/fluentd/pull/1274
|
28
|
+
* fluent-cat: Fix fluent-cat command to send sub-second precision time
|
29
|
+
https://github.com/fluent/fluentd/pull/1277
|
30
|
+
* config: Fix a bug not to overwrite default value with nil
|
31
|
+
https://github.com/fluent/fluentd/pull/1296
|
32
|
+
* output: Fix timezone for compat timesliced output plugins
|
33
|
+
https://github.com/fluent/fluentd/pull/1307
|
34
|
+
* out_forward: fix not to raise error when out_forward is initialized as secondary
|
35
|
+
https://github.com/fluent/fluentd/pull/1313
|
36
|
+
* output: Event router for secondary output
|
37
|
+
https://github.com/fluent/fluentd/pull/1283
|
38
|
+
* test: fix to return the block value as expected by many rubyists
|
39
|
+
https://github.com/fluent/fluentd/pull/1284
|
40
|
+
|
3
41
|
## Release v0.14.8 - 2016/10/13
|
4
42
|
|
5
43
|
### Bug fixes
|
data/Rakefile
CHANGED
@@ -24,6 +24,9 @@ end
|
|
24
24
|
|
25
25
|
desc 'Run test_unit based test'
|
26
26
|
Rake::TestTask.new(:base_test) do |t|
|
27
|
+
# To run test with dumping all test case names (to find never ending test case)
|
28
|
+
# $ bundle exec rake test TESTOPTS=-v
|
29
|
+
#
|
27
30
|
# To run test for only one file (or file path pattern)
|
28
31
|
# $ bundle exec rake base_test TEST=test/test_specified_path.rb
|
29
32
|
# $ bundle exec rake base_test TEST=test/test_*.rb
|
@@ -50,4 +53,22 @@ task :coverage do |t|
|
|
50
53
|
Rake::Task["test"].invoke
|
51
54
|
end
|
52
55
|
|
56
|
+
desc 'Build Coverity tarball & upload it'
|
57
|
+
task :coverity do
|
58
|
+
# https://scan.coverity.com/projects/fluentd?tab=overview
|
59
|
+
# See "View Defects" after sign-in.
|
60
|
+
#
|
61
|
+
# Setup steps:
|
62
|
+
# 1. get coverity build tool and set PATH to bin/: https://scan.coverity.com/download
|
63
|
+
# 2. set environment variables:
|
64
|
+
# * $COVERITY_USER (your email address)
|
65
|
+
# * $COVERITY_TOKEN (token for Fluentd project: https://scan.coverity.com/projects/fluentd?tab=project_settings)
|
66
|
+
sh "cov-build --dir cov-int --no-command --fs-capture-search ./"
|
67
|
+
sh "tar czf cov-fluentd.tar.gz cov-int"
|
68
|
+
user = ENV['COVERITY_USER']
|
69
|
+
token = ENV['COVERITY_TOKEN']
|
70
|
+
sh "curl --form token=#{token} --form email=#{user} --form file=@cov-fluentd.tar.gz --form version=\"Master\" --form description=\"GIT Master\" https://scan.coverity.com/builds?project=Fluentd"
|
71
|
+
FileUtils.rm_rf(['./cov-int', 'cov-fluentd.tar.gz'])
|
72
|
+
end
|
73
|
+
|
53
74
|
task default: [:test, :build]
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<source>
|
2
|
+
@type dummy
|
3
|
+
@label @exec
|
4
|
+
tag exec_input
|
5
|
+
rate 10
|
6
|
+
auto_increment_key num
|
7
|
+
dummy {"data":"mydata"}
|
8
|
+
</source>
|
9
|
+
|
10
|
+
<label @exec>
|
11
|
+
<match exec_input>
|
12
|
+
@type exec_filter
|
13
|
+
@label @stdout
|
14
|
+
tag result
|
15
|
+
command ruby -e 'STDOUT.sync = true; proc = ->(){line = STDIN.readline.chomp; puts line + "\t" + Process.pid.to_s}; 1000.times{ proc.call }'
|
16
|
+
num_children 3
|
17
|
+
child_respawn -1
|
18
|
+
<inject>
|
19
|
+
time_key time
|
20
|
+
time_type float
|
21
|
+
</inject>
|
22
|
+
<format>
|
23
|
+
@type tsv
|
24
|
+
keys data, num, time
|
25
|
+
</format>
|
26
|
+
<parse>
|
27
|
+
@type tsv
|
28
|
+
keys data, num, time, pid
|
29
|
+
</parse>
|
30
|
+
<extract>
|
31
|
+
time_key time
|
32
|
+
time_type float
|
33
|
+
</extract>
|
34
|
+
</match>
|
35
|
+
</label>
|
36
|
+
|
37
|
+
<label @stdout>
|
38
|
+
<match result>
|
39
|
+
@type stdout
|
40
|
+
</match>
|
41
|
+
</label>
|
42
|
+
|
data/lib/fluent/agent.rb
CHANGED
@@ -123,7 +123,7 @@ module Fluent
|
|
123
123
|
log.info "adding match#{@context.nil? ? '' : " in #{@context}"}", pattern: pattern, type: type
|
124
124
|
|
125
125
|
output = Plugin.new_output(type)
|
126
|
-
output.
|
126
|
+
output.context_router = @event_router
|
127
127
|
output.configure(conf)
|
128
128
|
@outputs << output
|
129
129
|
if output.respond_to?(:outputs) && output.respond_to?(:multi_output?) && output.multi_output?
|
@@ -144,7 +144,7 @@ module Fluent
|
|
144
144
|
log.info "adding filter#{@context.nil? ? '' : " in #{@context}"}", pattern: pattern, type: type
|
145
145
|
|
146
146
|
filter = Plugin.new_filter(type)
|
147
|
-
filter.
|
147
|
+
filter.context_router = @event_router
|
148
148
|
filter.configure(conf)
|
149
149
|
@filters << filter
|
150
150
|
@event_router.add_rule(pattern, filter)
|
@@ -164,7 +164,7 @@ module BinlogReaderCommand
|
|
164
164
|
def call
|
165
165
|
@formatter = lookup_formatter(@options[:format], @options[:config_params])
|
166
166
|
|
167
|
-
File.open(@path, '
|
167
|
+
File.open(@path, 'rb') do |io|
|
168
168
|
i = 1
|
169
169
|
Fluent::MessagePackFactory.unpacker(io).each do |(time, record)|
|
170
170
|
print @formatter.format(@path, time, record) # path is used for tag
|
data/lib/fluent/command/cat.rb
CHANGED
@@ -16,6 +16,8 @@
|
|
16
16
|
|
17
17
|
require 'optparse'
|
18
18
|
require 'fluent/env'
|
19
|
+
require 'fluent/time'
|
20
|
+
require 'fluent/msgpack_factory'
|
19
21
|
|
20
22
|
op = OptionParser.new
|
21
23
|
|
@@ -143,7 +145,7 @@ class Writer
|
|
143
145
|
raise ArgumentError, "Input must be a map (got #{record.class})"
|
144
146
|
end
|
145
147
|
|
146
|
-
entry = [
|
148
|
+
entry = [Fluent::EventTime.now, record]
|
147
149
|
synchronize {
|
148
150
|
unless write_impl([entry])
|
149
151
|
# write failed
|
@@ -200,7 +202,8 @@ class Writer
|
|
200
202
|
end
|
201
203
|
|
202
204
|
begin
|
203
|
-
|
205
|
+
packer = Fluent::MessagePackFactory.packer
|
206
|
+
socket.write packer.pack([@tag, array])
|
204
207
|
socket.flush
|
205
208
|
rescue
|
206
209
|
$stderr.puts "write failed: #{$!}"
|
data/lib/fluent/compat/output.rb
CHANGED
@@ -617,17 +617,16 @@ module Fluent
|
|
617
617
|
end
|
618
618
|
|
619
619
|
if conf['timezone']
|
620
|
-
|
621
|
-
Fluent::Timezone.validate!(@timezone)
|
620
|
+
Fluent::Timezone.validate!(conf['timezone'])
|
622
621
|
elsif conf['utc']
|
623
|
-
|
624
|
-
|
622
|
+
conf['timezone'] = "+0000"
|
623
|
+
conf['localtime'] = "false"
|
625
624
|
elsif conf['localtime']
|
626
|
-
|
627
|
-
|
625
|
+
conf['timezone'] = Time.now.strftime('%z')
|
626
|
+
conf['localtime'] = "true"
|
628
627
|
else
|
629
|
-
|
630
|
-
|
628
|
+
conf['timezone'] = "+0000" # v0.12 assumes UTC without any configuration
|
629
|
+
conf['localtime'] = "false"
|
631
630
|
end
|
632
631
|
|
633
632
|
@_timekey = case conf['time_slice_format']
|
data/lib/fluent/compat/parser.rb
CHANGED
@@ -18,6 +18,9 @@ require 'fluent/plugin'
|
|
18
18
|
require 'fluent/plugin/parser'
|
19
19
|
require 'fluent/mixin'
|
20
20
|
|
21
|
+
require 'fluent/config'
|
22
|
+
require 'fluent/compat/type_converter'
|
23
|
+
|
21
24
|
require 'fluent/plugin/parser_regexp'
|
22
25
|
require 'fluent/plugin/parser_json'
|
23
26
|
require 'fluent/plugin/parser_tsv'
|
@@ -56,13 +59,14 @@ module Fluent
|
|
56
59
|
format = conf['format']
|
57
60
|
|
58
61
|
@parser = TextParser.lookup(format)
|
59
|
-
if ! @estimate_current_event.nil? && @parser.respond_to?(:'estimate_current_event=')
|
60
|
-
@parser.estimate_current_event = @estimate_current_event
|
61
|
-
end
|
62
62
|
|
63
63
|
if @parser.respond_to?(:configure)
|
64
64
|
@parser.configure(conf)
|
65
65
|
end
|
66
|
+
if !@estimate_current_event.nil? && @parser.respond_to?(:'estimate_current_event=')
|
67
|
+
# external code sets parser.estimate_current_event = false
|
68
|
+
@parser.estimate_current_event = @estimate_current_event
|
69
|
+
end
|
66
70
|
|
67
71
|
return true
|
68
72
|
end
|
@@ -116,23 +120,57 @@ module Fluent
|
|
116
120
|
end
|
117
121
|
end
|
118
122
|
|
119
|
-
|
123
|
+
module TypeConverterCompatParameters
|
124
|
+
def convert_type_converter_parameters!(conf)
|
125
|
+
if conf["types"]
|
126
|
+
delimiter = conf["types_delimiter"] || ','
|
127
|
+
label_delimiter = conf["types_label_delimiter"] || ':'
|
128
|
+
types = {}
|
129
|
+
conf['types'].split(delimiter).each do |pair|
|
130
|
+
key, value = pair.split(label_delimiter, 2)
|
131
|
+
if value.start_with?("time#{label_delimiter}")
|
132
|
+
value = value.split(label_delimiter, 2).join(':')
|
133
|
+
elsif value.start_with?("array#{label_delimiter}")
|
134
|
+
value = value.split(label_delimiter, 2).join(':')
|
135
|
+
end
|
136
|
+
types[key] = value
|
137
|
+
end
|
138
|
+
conf["types"] = JSON.dump(types)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
|
143
|
+
class TimeParser < Fluent::TimeParser
|
120
144
|
# TODO: warn when deprecated
|
121
145
|
end
|
122
146
|
|
123
147
|
class RegexpParser < Fluent::Plugin::RegexpParser
|
148
|
+
include TypeConverterCompatParameters
|
149
|
+
|
124
150
|
# TODO: warn when deprecated
|
125
151
|
def initialize(regexp, conf = {})
|
126
152
|
super()
|
127
153
|
|
154
|
+
@stored_regexp = regexp
|
155
|
+
@manually_configured = false
|
128
156
|
unless conf.empty?
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
157
|
+
conf_init = if conf.is_a?(Fluent::Config::Element)
|
158
|
+
conf
|
159
|
+
else
|
160
|
+
Fluent::Config::Element.new('parse', '', conf, [])
|
161
|
+
end
|
162
|
+
self.configure(conf_init)
|
163
|
+
@manually_configured = true
|
133
164
|
end
|
165
|
+
end
|
166
|
+
|
167
|
+
def configure(conf)
|
168
|
+
return if @manually_configured # not to run twice
|
169
|
+
|
170
|
+
conf['expression'] ||= @stored_regexp.source
|
171
|
+
convert_type_converter_parameters!(conf)
|
134
172
|
|
135
|
-
|
173
|
+
super
|
136
174
|
end
|
137
175
|
|
138
176
|
def patterns
|
@@ -140,24 +178,114 @@ module Fluent
|
|
140
178
|
end
|
141
179
|
end
|
142
180
|
|
143
|
-
class ValuesParser <
|
144
|
-
|
181
|
+
class ValuesParser < Parser
|
182
|
+
include Fluent::Compat::TypeConverter
|
183
|
+
|
184
|
+
config_param :keys, :array, default: []
|
185
|
+
config_param :time_key, :string, default: nil
|
186
|
+
config_param :null_value_pattern, :string, default: nil
|
187
|
+
config_param :null_empty_string, :bool, default: false
|
188
|
+
|
189
|
+
def configure(conf)
|
190
|
+
super
|
191
|
+
|
192
|
+
if @time_key && !@keys.include?(@time_key) && @estimate_current_event
|
193
|
+
raise Fluent::ConfigError, "time_key (#{@time_key.inspect}) is not included in keys (#{@keys.inspect})"
|
194
|
+
end
|
195
|
+
|
196
|
+
if @time_format && !@time_key
|
197
|
+
raise Fluent::ConfigError, "time_format parameter is ignored because time_key parameter is not set. at #{conf.inspect}"
|
198
|
+
end
|
199
|
+
|
200
|
+
@time_parser = time_parser_create
|
201
|
+
|
202
|
+
if @null_value_pattern
|
203
|
+
@null_value_pattern = Regexp.new(@null_value_pattern)
|
204
|
+
end
|
205
|
+
|
206
|
+
@mutex = Mutex.new
|
207
|
+
end
|
208
|
+
|
209
|
+
def values_map(values)
|
210
|
+
record = Hash[keys.zip(values.map { |value| convert_value_to_nil(value) })]
|
211
|
+
|
212
|
+
if @time_key
|
213
|
+
value = @keep_time_key ? record[@time_key] : record.delete(@time_key)
|
214
|
+
time = if value.nil?
|
215
|
+
if @estimate_current_event
|
216
|
+
Fluent::EventTime.now
|
217
|
+
else
|
218
|
+
nil
|
219
|
+
end
|
220
|
+
else
|
221
|
+
@mutex.synchronize { @time_parser.parse(value) }
|
222
|
+
end
|
223
|
+
elsif @estimate_current_event
|
224
|
+
time = Fluent::EventTime.now
|
225
|
+
else
|
226
|
+
time = nil
|
227
|
+
end
|
228
|
+
|
229
|
+
convert_field_type!(record) if @type_converters
|
230
|
+
|
231
|
+
return time, record
|
232
|
+
end
|
233
|
+
|
234
|
+
private
|
235
|
+
|
236
|
+
def convert_field_type!(record)
|
237
|
+
@type_converters.each_key { |key|
|
238
|
+
if value = record[key]
|
239
|
+
record[key] = convert_type(key, value)
|
240
|
+
end
|
241
|
+
}
|
242
|
+
end
|
243
|
+
|
244
|
+
def convert_value_to_nil(value)
|
245
|
+
if value and @null_empty_string
|
246
|
+
value = (value == '') ? nil : value
|
247
|
+
end
|
248
|
+
if value and @null_value_pattern
|
249
|
+
value = ::Fluent::StringUtil.match_regexp(@null_value_pattern, value) ? nil : value
|
250
|
+
end
|
251
|
+
value
|
252
|
+
end
|
145
253
|
end
|
146
254
|
|
147
255
|
class JSONParser < Fluent::Plugin::JSONParser
|
256
|
+
include TypeConverterCompatParameters
|
148
257
|
# TODO: warn when deprecated
|
258
|
+
def configure(conf)
|
259
|
+
convert_type_converter_parameters!(conf)
|
260
|
+
super
|
261
|
+
end
|
149
262
|
end
|
150
263
|
|
151
264
|
class TSVParser < Fluent::Plugin::TSVParser
|
265
|
+
include TypeConverterCompatParameters
|
152
266
|
# TODO: warn when deprecated
|
267
|
+
def configure(conf)
|
268
|
+
convert_type_converter_parameters!(conf)
|
269
|
+
super
|
270
|
+
end
|
153
271
|
end
|
154
272
|
|
155
273
|
class LabeledTSVParser < Fluent::Plugin::LabeledTSVParser
|
274
|
+
include TypeConverterCompatParameters
|
156
275
|
# TODO: warn when deprecated
|
276
|
+
def configure(conf)
|
277
|
+
convert_type_converter_parameters!(conf)
|
278
|
+
super
|
279
|
+
end
|
157
280
|
end
|
158
281
|
|
159
282
|
class CSVParser < Fluent::Plugin::CSVParser
|
283
|
+
include TypeConverterCompatParameters
|
160
284
|
# TODO: warn when deprecated
|
285
|
+
def configure(conf)
|
286
|
+
convert_type_converter_parameters!(conf)
|
287
|
+
super
|
288
|
+
end
|
161
289
|
end
|
162
290
|
|
163
291
|
class NoneParser < Fluent::Plugin::NoneParser
|
@@ -123,7 +123,7 @@ module Fluent
|
|
123
123
|
end
|
124
124
|
|
125
125
|
# configured_in MUST be kept
|
126
|
-
merged.configured_in_section = self.configured_in_section
|
126
|
+
merged.configured_in_section = self.configured_in_section || other.configured_in_section
|
127
127
|
|
128
128
|
merged.argument = other.argument || self.argument
|
129
129
|
merged.params = other.params.merge(self.params)
|
@@ -177,7 +177,7 @@ module Fluent
|
|
177
177
|
self.class.new(@name, options)
|
178
178
|
end
|
179
179
|
|
180
|
-
merged.configured_in_section = self.configured_in_section
|
180
|
+
merged.configured_in_section = self.configured_in_section || other.configured_in_section
|
181
181
|
|
182
182
|
merged.argument = self.argument || other.argument
|
183
183
|
merged.params = other.params.merge(self.params)
|
@@ -339,15 +339,6 @@ module Fluent
|
|
339
339
|
sub_proxy = ConfigureProxy.new(name, type_lookup: @type_lookup, **kwargs)
|
340
340
|
sub_proxy.instance_exec(&block)
|
341
341
|
|
342
|
-
if sub_proxy.init?
|
343
|
-
if sub_proxy.argument && !sub_proxy.defaults.has_key?(sub_proxy.argument.first)
|
344
|
-
raise ArgumentError, "#{name}: init is specified, but default value of argument is missing"
|
345
|
-
end
|
346
|
-
if sub_proxy.params.keys.any?{|param_name| !sub_proxy.defaults.has_key?(param_name)}
|
347
|
-
raise ArgumentError, "#{name}: init is specified, but there're parameters without default values"
|
348
|
-
end
|
349
|
-
end
|
350
|
-
|
351
342
|
@params.delete(name)
|
352
343
|
@sections[name] = sub_proxy
|
353
344
|
|