fluentd 0.10.62 → 0.12.0.pre.1
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 +1 -2
- data/.travis.yml +0 -4
- data/ChangeLog +0 -72
- data/Gemfile +0 -6
- data/Rakefile +12 -3
- data/example/in_http.conf +14 -0
- data/example/in_syslog.conf +15 -0
- data/example/in_tail.conf +14 -0
- data/example/in_tcp.conf +13 -0
- data/example/in_udp.conf +13 -0
- data/example/out_copy.conf +20 -0
- data/example/out_file.conf +13 -0
- data/example/out_forward.conf +30 -0
- data/fluent.conf +2 -12
- data/fluentd.gemspec +8 -11
- data/lib/fluent/agent.rb +180 -0
- data/lib/fluent/buffer.rb +6 -12
- data/lib/fluent/command/cat.rb +1 -3
- data/lib/fluent/command/debug.rb +1 -3
- data/lib/fluent/command/fluentd.rb +0 -10
- data/lib/fluent/config.rb +9 -3
- data/lib/fluent/config/basic_parser.rb +1 -6
- data/lib/fluent/config/configure_proxy.rb +25 -61
- data/lib/fluent/config/dsl.rb +16 -0
- data/lib/fluent/config/element.rb +21 -2
- data/lib/fluent/config/error.rb +16 -0
- data/lib/fluent/config/literal_parser.rb +9 -27
- data/lib/fluent/config/parser.rb +16 -0
- data/lib/fluent/config/section.rb +16 -2
- data/lib/fluent/config/types.rb +16 -1
- data/lib/fluent/config/v1_parser.rb +4 -12
- data/lib/fluent/configurable.rb +16 -0
- data/lib/fluent/engine.rb +43 -163
- data/lib/fluent/env.rb +16 -1
- data/lib/fluent/event.rb +20 -48
- data/lib/fluent/event_router.rb +187 -0
- data/lib/fluent/filter.rb +32 -0
- data/lib/fluent/formatter.rb +29 -101
- data/lib/fluent/input.rb +6 -4
- data/lib/fluent/label.rb +18 -0
- data/lib/fluent/load.rb +1 -3
- data/lib/fluent/log.rb +1 -3
- data/lib/fluent/match.rb +12 -19
- data/lib/fluent/mixin.rb +9 -25
- data/lib/fluent/output.rb +27 -45
- data/lib/fluent/parser.rb +93 -99
- data/lib/fluent/plugin.rb +22 -48
- data/lib/fluent/plugin/buf_file.rb +10 -7
- data/lib/fluent/plugin/buf_memory.rb +2 -3
- data/lib/fluent/plugin/buf_zfile.rb +75 -0
- data/lib/fluent/plugin/exec_util.rb +16 -0
- data/lib/fluent/plugin/in_debug_agent.rb +2 -3
- data/lib/fluent/plugin/in_exec.rb +2 -9
- data/lib/fluent/plugin/in_forward.rb +4 -22
- data/lib/fluent/plugin/in_gc_stat.rb +2 -3
- data/lib/fluent/plugin/in_http.rb +19 -59
- data/lib/fluent/plugin/in_monitor_agent.rb +21 -47
- data/lib/fluent/plugin/in_object_space.rb +2 -3
- data/lib/fluent/plugin/in_status.rb +2 -3
- data/lib/fluent/plugin/in_stream.rb +6 -16
- data/lib/fluent/plugin/in_syslog.rb +8 -17
- data/lib/fluent/plugin/in_tail.rb +17 -24
- data/lib/fluent/plugin/in_tcp.rb +16 -0
- data/lib/fluent/plugin/in_udp.rb +16 -0
- data/lib/fluent/plugin/out_copy.rb +3 -4
- data/lib/fluent/plugin/out_exec.rb +2 -4
- data/lib/fluent/plugin/out_exec_filter.rb +2 -13
- data/lib/fluent/plugin/out_file.rb +5 -6
- data/lib/fluent/plugin/out_forward.rb +4 -5
- data/lib/fluent/plugin/out_null.rb +2 -3
- data/lib/fluent/plugin/out_relabel.rb +26 -0
- data/lib/fluent/plugin/out_roundrobin.rb +3 -4
- data/lib/fluent/plugin/out_stdout.rb +2 -3
- data/lib/fluent/plugin/out_stream.rb +2 -3
- data/{test/scripts → lib}/fluent/plugin/out_test.rb +2 -3
- data/lib/fluent/plugin/socket_util.rb +19 -10
- data/lib/fluent/process.rb +4 -6
- data/lib/fluent/registry.rb +16 -0
- data/lib/fluent/root_agent.rb +212 -0
- data/lib/fluent/status.rb +2 -3
- data/lib/fluent/supervisor.rb +33 -54
- data/lib/fluent/test.rb +16 -0
- data/lib/fluent/test/base.rb +3 -17
- data/lib/fluent/test/input_test.rb +52 -7
- data/lib/fluent/test/output_test.rb +4 -20
- data/lib/fluent/version.rb +17 -1
- data/spec/config/config_parser_spec.rb +314 -0
- data/spec/config/configurable_spec.rb +524 -0
- data/spec/config/configure_proxy_spec.rb +96 -0
- data/spec/config/dsl_spec.rb +239 -0
- data/spec/config/helper.rb +49 -0
- data/spec/config/literal_parser_spec.rb +222 -0
- data/spec/config/section_spec.rb +97 -0
- data/spec/config/system_config_spec.rb +49 -0
- data/test/helper.rb +0 -25
- data/test/plugin/test_in_exec.rb +1 -1
- data/test/plugin/test_in_forward.rb +2 -1
- data/test/plugin/test_in_gc_stat.rb +1 -1
- data/test/plugin/test_in_http.rb +3 -78
- data/test/plugin/test_in_object_space.rb +1 -1
- data/test/plugin/test_in_status.rb +1 -1
- data/test/plugin/test_in_stream.rb +2 -1
- data/test/plugin/test_in_syslog.rb +2 -1
- data/test/plugin/test_in_tail.rb +6 -11
- data/test/plugin/test_in_tcp.rb +2 -1
- data/test/plugin/test_in_udp.rb +2 -1
- data/test/plugin/test_out_copy.rb +1 -12
- data/test/plugin/test_out_exec.rb +1 -1
- data/test/plugin/test_out_exec_filter.rb +1 -1
- data/test/plugin/test_out_file.rb +7 -96
- data/test/plugin/test_out_forward.rb +2 -1
- data/test/plugin/test_out_roundrobin.rb +1 -12
- data/test/plugin/test_out_stdout.rb +1 -1
- data/test/plugin/test_out_stream.rb +2 -1
- data/test/scripts/fluent/plugin/formatter_known.rb +1 -4
- data/test/scripts/fluent/plugin/parser_known.rb +1 -2
- data/test/test_config.rb +1 -1
- data/test/test_configdsl.rb +2 -1
- data/test/test_formatter.rb +3 -395
- data/test/test_match.rb +2 -1
- data/test/test_mixin.rb +3 -75
- data/test/test_output.rb +1 -112
- data/test/test_parser.rb +85 -152
- metadata +58 -167
- data/example/v1_literal_example.conf +0 -36
- data/lib/fluent/plugin/in_dummy.rb +0 -103
- data/lib/fluent/timezone.rb +0 -131
- data/test/config/assertions.rb +0 -42
- data/test/config/test_config_parser.rb +0 -389
- data/test/config/test_configurable.rb +0 -652
- data/test/config/test_configure_proxy.rb +0 -99
- data/test/config/test_dsl.rb +0 -237
- data/test/config/test_literal_parser.rb +0 -295
- data/test/config/test_section.rb +0 -112
- data/test/config/test_system_config.rb +0 -99
- data/test/config/test_types.rb +0 -63
- data/test/plugin/test_in_dummy.rb +0 -95
- data/test/test_event.rb +0 -168
- data/test/test_input.rb +0 -21
data/lib/fluent/buffer.rb
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#
|
2
|
-
#
|
3
|
-
#
|
4
|
-
# Copyright (C) 2011 FURUHASHI Sadayuki
|
2
|
+
# Fluentd
|
5
3
|
#
|
6
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
5
|
# you may not use this file except in compliance with the License.
|
@@ -223,15 +221,11 @@ module Fluent
|
|
223
221
|
|
224
222
|
def total_queued_chunk_size
|
225
223
|
total = 0
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
@queue.each {|c|
|
232
|
-
total += c.size
|
233
|
-
}
|
234
|
-
}
|
224
|
+
@map.each_value {|c|
|
225
|
+
total += c.size
|
226
|
+
}
|
227
|
+
@queue.each {|c|
|
228
|
+
total += c.size
|
235
229
|
}
|
236
230
|
total
|
237
231
|
end
|
data/lib/fluent/command/cat.rb
CHANGED
data/lib/fluent/command/debug.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Fluentd
|
3
3
|
#
|
4
|
-
# Copyright (C) 2011 FURUHASHI Sadayuki
|
5
|
-
#
|
6
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
5
|
# you may not use this file except in compliance with the License.
|
8
6
|
# You may obtain a copy of the License at
|
@@ -52,10 +50,6 @@ op.on('-d', '--daemon PIDFILE', "daemonize fluent process") {|s|
|
|
52
50
|
opts[:daemonize] = s
|
53
51
|
}
|
54
52
|
|
55
|
-
op.on('--no-supervisor', "run without fluent supervisor") {
|
56
|
-
opts[:supervise] = false
|
57
|
-
}
|
58
|
-
|
59
53
|
op.on('--user USER', "change user") {|s|
|
60
54
|
opts[:chuser] = s
|
61
55
|
}
|
@@ -88,10 +82,6 @@ op.on('--use-v1-config', "Use v1 configuration format", TrueClass) {|b|
|
|
88
82
|
opts[:use_v1_config] = b
|
89
83
|
}
|
90
84
|
|
91
|
-
op.on('--use-v0-config', "Use v0 configuration format (default)", TrueClass) {|b|
|
92
|
-
opts[:use_v1_config] = !b
|
93
|
-
}
|
94
|
-
|
95
85
|
op.on('-v', '--verbose', "increase verbose level (-v: debug, -vv: trace)", TrueClass) {|b|
|
96
86
|
if b
|
97
87
|
opts[:log_level] = [opts[:log_level] - 1, Fluent::Log::LEVEL_TRACE].max
|
data/lib/fluent/config.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
#
|
2
2
|
# Fluent
|
3
3
|
#
|
4
|
-
# Copyright (C) 2011 FURUHASHI Sadayuki
|
5
|
-
#
|
6
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
7
5
|
# you may not use this file except in compliance with the License.
|
8
6
|
# You may obtain a copy of the License at
|
@@ -15,6 +13,7 @@
|
|
15
13
|
# See the License for the specific language governing permissions and
|
16
14
|
# limitations under the License.
|
17
15
|
#
|
16
|
+
|
18
17
|
module Fluent
|
19
18
|
require 'fluent/config/error'
|
20
19
|
require 'fluent/config/element'
|
@@ -44,10 +43,17 @@ module Fluent
|
|
44
43
|
|
45
44
|
module PluginId
|
46
45
|
def configure(conf)
|
47
|
-
@id = conf['
|
46
|
+
@id = conf['id']
|
48
47
|
super
|
49
48
|
end
|
50
49
|
|
50
|
+
def require_id
|
51
|
+
unless @id
|
52
|
+
raise ConfigError, "'id' parameter is required"
|
53
|
+
end
|
54
|
+
@id
|
55
|
+
end
|
56
|
+
|
51
57
|
def plugin_id
|
52
58
|
@id ? @id : "object:#{object_id.to_s(16)}"
|
53
59
|
end
|
@@ -13,6 +13,7 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
|
+
|
16
17
|
module Fluent
|
17
18
|
module Config
|
18
19
|
|
@@ -26,8 +27,6 @@ module Fluent
|
|
26
27
|
|
27
28
|
LINE_END = /(?:[ \t]*(?:\#.*)?(?:\z|[\r\n]))+/
|
28
29
|
SPACING = /(?:[ \t\r\n]|\z|\#.*?(?:\z|[\r\n]))+/
|
29
|
-
ZERO_OR_MORE_SPACING = /(?:[ \t\r\n]|\z|\#.*?(?:\z|[\r\n]))*/
|
30
|
-
SPACING_WITHOUT_COMMENT = /(?:[ \t\r\n]|\z)+/
|
31
30
|
|
32
31
|
module ClassMethods
|
33
32
|
def symbol(string)
|
@@ -79,10 +78,6 @@ module Fluent
|
|
79
78
|
skip(SPACING)
|
80
79
|
end
|
81
80
|
|
82
|
-
def spacing_without_comment
|
83
|
-
skip(SPACING_WITHOUT_COMMENT)
|
84
|
-
end
|
85
|
-
|
86
81
|
def parse_error!(message)
|
87
82
|
raise ConfigParseError, "#{message} at #{error_sample}"
|
88
83
|
end
|
@@ -1,7 +1,23 @@
|
|
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
|
+
|
1
17
|
module Fluent
|
2
18
|
module Config
|
3
19
|
class ConfigureProxy
|
4
|
-
attr_accessor :name, :
|
20
|
+
attr_accessor :name, :param_name, :required, :multi, :alias, :argument, :params, :defaults, :sections
|
5
21
|
# config_param :desc, :string, :default => '....'
|
6
22
|
# config_set_default :buffer_type, :memory
|
7
23
|
#
|
@@ -22,7 +38,6 @@ module Fluent
|
|
22
38
|
|
23
39
|
def initialize(name, opts = {})
|
24
40
|
@name = name.to_sym
|
25
|
-
@final = opts.fetch(:final, false)
|
26
41
|
|
27
42
|
@param_name = (opts[:param_name] || @name).to_sym
|
28
43
|
@required = opts[:required]
|
@@ -43,13 +58,7 @@ module Fluent
|
|
43
58
|
@multi.nil? ? true : @multi
|
44
59
|
end
|
45
60
|
|
46
|
-
def final?
|
47
|
-
@final
|
48
|
-
end
|
49
|
-
|
50
61
|
def merge(other) # self is base class, other is subclass
|
51
|
-
return merge_for_finalized(other) if self.final?
|
52
|
-
|
53
62
|
options = {
|
54
63
|
param_name: other.param_name,
|
55
64
|
required: (other.required.nil? ? self.required : other.required),
|
@@ -60,52 +69,7 @@ module Fluent
|
|
60
69
|
merged.argument = other.argument || self.argument
|
61
70
|
merged.params = self.params.merge(other.params)
|
62
71
|
merged.defaults = self.defaults.merge(other.defaults)
|
63
|
-
merged.sections =
|
64
|
-
(self.sections.keys + other.sections.keys).uniq.each do |section_key|
|
65
|
-
self_section = self.sections[section_key]
|
66
|
-
other_section = other.sections[section_key]
|
67
|
-
merged_section = if self_section && other_section
|
68
|
-
self_section.merge(other_section)
|
69
|
-
elsif self_section || other_section
|
70
|
-
self_section || other_section
|
71
|
-
else
|
72
|
-
raise "BUG: both of self and other section are nil"
|
73
|
-
end
|
74
|
-
merged.sections[section_key] = merged_section
|
75
|
-
end
|
76
|
-
|
77
|
-
merged
|
78
|
-
end
|
79
|
-
|
80
|
-
def merge_for_finalized(other)
|
81
|
-
# list what subclass can do for finalized section
|
82
|
-
# * overwrite param_name to escape duplicated name of instance variable
|
83
|
-
# * append params/defaults/sections which are missing in superclass
|
84
|
-
|
85
|
-
options = {
|
86
|
-
param_name: other.param_name,
|
87
|
-
required: (self.required.nil? ? other.required : self.required),
|
88
|
-
multi: (self.multi.nil? ? other.multi : self.multi),
|
89
|
-
final: true,
|
90
|
-
}
|
91
|
-
merged = self.class.new(other.name, options)
|
92
|
-
|
93
|
-
merged.argument = self.argument || other.argument
|
94
|
-
merged.params = other.params.merge(self.params)
|
95
|
-
merged.defaults = other.defaults.merge(self.defaults)
|
96
|
-
merged.sections = {}
|
97
|
-
(self.sections.keys + other.sections.keys).uniq.each do |section_key|
|
98
|
-
self_section = self.sections[section_key]
|
99
|
-
other_section = other.sections[section_key]
|
100
|
-
merged_section = if self_section && other_section
|
101
|
-
other_section.merge(self_section)
|
102
|
-
elsif self_section || other_section
|
103
|
-
self_section || other_section
|
104
|
-
else
|
105
|
-
raise "BUG: both of self and other section are nil"
|
106
|
-
end
|
107
|
-
merged.sections[section_key] = merged_section
|
108
|
-
end
|
72
|
+
merged.sections = self.sections.merge(other.sections)
|
109
73
|
|
110
74
|
merged
|
111
75
|
end
|
@@ -120,13 +84,13 @@ module Fluent
|
|
120
84
|
elsif a.is_a?(Hash)
|
121
85
|
opts.merge!(a)
|
122
86
|
else
|
123
|
-
raise ArgumentError, "
|
87
|
+
raise ArgumentError, "wrong number of arguments (#{1 + args.length} for #{block ? 2 : 3})"
|
124
88
|
end
|
125
89
|
}
|
126
90
|
|
127
91
|
type = opts[:type]
|
128
92
|
if block && type
|
129
|
-
raise ArgumentError, "
|
93
|
+
raise ArgumentError, "both of block and type cannot be specified"
|
130
94
|
end
|
131
95
|
|
132
96
|
begin
|
@@ -134,7 +98,7 @@ module Fluent
|
|
134
98
|
block ||= Configurable.lookup_type(type)
|
135
99
|
rescue ConfigError
|
136
100
|
# override error message
|
137
|
-
raise ArgumentError, "
|
101
|
+
raise ArgumentError, "unknown config_argument type `#{type}'"
|
138
102
|
end
|
139
103
|
|
140
104
|
if opts.has_key?(:default)
|
@@ -146,7 +110,7 @@ module Fluent
|
|
146
110
|
|
147
111
|
def config_argument(name, *args, &block)
|
148
112
|
if @argument
|
149
|
-
raise ArgumentError, "
|
113
|
+
raise ArgumentError, "config_argument called twice"
|
150
114
|
end
|
151
115
|
name, block, opts = parameter_configuration(name, *args, &block)
|
152
116
|
|
@@ -166,7 +130,7 @@ module Fluent
|
|
166
130
|
name = name.to_sym
|
167
131
|
|
168
132
|
if @defaults.has_key?(name)
|
169
|
-
raise ArgumentError, "
|
133
|
+
raise ArgumentError, "default value specified twice for #{name}"
|
170
134
|
end
|
171
135
|
|
172
136
|
@defaults[name] = defval
|
@@ -175,13 +139,13 @@ module Fluent
|
|
175
139
|
|
176
140
|
def config_section(name, *args, &block)
|
177
141
|
unless block_given?
|
178
|
-
raise ArgumentError, "
|
142
|
+
raise ArgumentError, "config_section requires block parameter"
|
179
143
|
end
|
180
144
|
name = name.to_sym
|
181
145
|
|
182
146
|
opts = {}
|
183
147
|
unless args.empty? || args.size == 1 && args.first.is_a?(Hash)
|
184
|
-
raise ArgumentError, "
|
148
|
+
raise ArgumentError, "unknown config_section arguments: #{args.inspect}"
|
185
149
|
end
|
186
150
|
|
187
151
|
sub_proxy = ConfigureProxy.new(name, *args)
|
data/lib/fluent/config/dsl.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
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
|
+
|
1
17
|
require 'fluent/config'
|
2
18
|
|
3
19
|
module Fluent
|
@@ -1,3 +1,19 @@
|
|
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
|
+
|
1
17
|
module Fluent
|
2
18
|
require 'fluent/config/error'
|
3
19
|
|
@@ -29,7 +45,6 @@ module Fluent
|
|
29
45
|
"name:#{@name}, arg:#{@arg}, " + attrs + ", " + @elements.inspect
|
30
46
|
end
|
31
47
|
|
32
|
-
# This method assumes _o_ is an Element object. Should return false for nil or other object
|
33
48
|
def ==(o)
|
34
49
|
self.name == o.name && self.arg == o.arg &&
|
35
50
|
self.keys.size == o.keys.size &&
|
@@ -87,7 +102,11 @@ module Fluent
|
|
87
102
|
out << "#{indent}<#{@name} #{@arg}>\n"
|
88
103
|
end
|
89
104
|
each_pair { |k, v|
|
90
|
-
|
105
|
+
if @v1_config
|
106
|
+
out << "#{nindent}#{k} #{Element.unescape_parameter(v)}\n"
|
107
|
+
else
|
108
|
+
out << "#{nindent}#{k} #{v}\n"
|
109
|
+
end
|
91
110
|
}
|
92
111
|
@elements.each { |e|
|
93
112
|
out << e.to_s(nest + 1)
|
data/lib/fluent/config/error.rb
CHANGED
@@ -1,3 +1,19 @@
|
|
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
|
+
|
1
17
|
module Fluent
|
2
18
|
class ConfigError < StandardError
|
3
19
|
end
|
@@ -13,6 +13,7 @@
|
|
13
13
|
# See the License for the specific language governing permissions and
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
|
+
|
16
17
|
module Fluent
|
17
18
|
module Config
|
18
19
|
|
@@ -50,7 +51,7 @@ module Fluent
|
|
50
51
|
end
|
51
52
|
|
52
53
|
def parse_literal(string_boundary_charset = LINE_END)
|
53
|
-
|
54
|
+
spacing
|
54
55
|
|
55
56
|
value = if skip(/\[/)
|
56
57
|
scan_json(true)
|
@@ -64,15 +65,13 @@ module Fluent
|
|
64
65
|
|
65
66
|
def scan_string(string_boundary_charset = LINE_END)
|
66
67
|
if skip(/\"/)
|
67
|
-
return
|
68
|
-
elsif skip(/\'/)
|
69
|
-
return scan_single_quoted_string
|
68
|
+
return scan_quoted_string
|
70
69
|
else
|
71
70
|
return scan_nonquoted_string(string_boundary_charset)
|
72
71
|
end
|
73
72
|
end
|
74
73
|
|
75
|
-
def
|
74
|
+
def scan_quoted_string
|
76
75
|
string = []
|
77
76
|
while true
|
78
77
|
if skip(/\"/)
|
@@ -85,24 +84,7 @@ module Fluent
|
|
85
84
|
elsif s = scan(/./)
|
86
85
|
string << s
|
87
86
|
else
|
88
|
-
parse_error! "unexpected end of file in a
|
89
|
-
end
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
def scan_single_quoted_string
|
94
|
-
string = []
|
95
|
-
while true
|
96
|
-
if skip(/\'/)
|
97
|
-
return string.join
|
98
|
-
elsif s = scan(/\\'/)
|
99
|
-
string << "'"
|
100
|
-
elsif s = scan(/\\\\/)
|
101
|
-
string << "\\"
|
102
|
-
elsif s = scan(/./)
|
103
|
-
string << s
|
104
|
-
else
|
105
|
-
parse_error! "unexpected end of file in a signle quoted string"
|
87
|
+
parse_error! "unexpected end of file in a quoted string"
|
106
88
|
end
|
107
89
|
end
|
108
90
|
end
|
@@ -112,8 +94,8 @@ module Fluent
|
|
112
94
|
|
113
95
|
string = []
|
114
96
|
while true
|
115
|
-
if s = scan(
|
116
|
-
string <<
|
97
|
+
if s = scan(/\\./)
|
98
|
+
string << eval_escape_char(s[1,1])
|
117
99
|
elsif s = scan(charset)
|
118
100
|
string << s
|
119
101
|
else
|
@@ -146,7 +128,7 @@ module Fluent
|
|
146
128
|
|
147
129
|
@ss.pos += code.length
|
148
130
|
|
149
|
-
|
131
|
+
code
|
150
132
|
end
|
151
133
|
|
152
134
|
def eval_embedded_code(code)
|
@@ -232,7 +214,7 @@ module Fluent
|
|
232
214
|
end
|
233
215
|
|
234
216
|
unless result
|
235
|
-
parse_error! "got incomplete
|
217
|
+
parse_error! "got incomplete #{is_array ? 'array' : 'hash'} configuration"
|
236
218
|
end
|
237
219
|
|
238
220
|
JSON.dump(result)
|