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.

Files changed (140) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/.travis.yml +0 -4
  4. data/ChangeLog +0 -72
  5. data/Gemfile +0 -6
  6. data/Rakefile +12 -3
  7. data/example/in_http.conf +14 -0
  8. data/example/in_syslog.conf +15 -0
  9. data/example/in_tail.conf +14 -0
  10. data/example/in_tcp.conf +13 -0
  11. data/example/in_udp.conf +13 -0
  12. data/example/out_copy.conf +20 -0
  13. data/example/out_file.conf +13 -0
  14. data/example/out_forward.conf +30 -0
  15. data/fluent.conf +2 -12
  16. data/fluentd.gemspec +8 -11
  17. data/lib/fluent/agent.rb +180 -0
  18. data/lib/fluent/buffer.rb +6 -12
  19. data/lib/fluent/command/cat.rb +1 -3
  20. data/lib/fluent/command/debug.rb +1 -3
  21. data/lib/fluent/command/fluentd.rb +0 -10
  22. data/lib/fluent/config.rb +9 -3
  23. data/lib/fluent/config/basic_parser.rb +1 -6
  24. data/lib/fluent/config/configure_proxy.rb +25 -61
  25. data/lib/fluent/config/dsl.rb +16 -0
  26. data/lib/fluent/config/element.rb +21 -2
  27. data/lib/fluent/config/error.rb +16 -0
  28. data/lib/fluent/config/literal_parser.rb +9 -27
  29. data/lib/fluent/config/parser.rb +16 -0
  30. data/lib/fluent/config/section.rb +16 -2
  31. data/lib/fluent/config/types.rb +16 -1
  32. data/lib/fluent/config/v1_parser.rb +4 -12
  33. data/lib/fluent/configurable.rb +16 -0
  34. data/lib/fluent/engine.rb +43 -163
  35. data/lib/fluent/env.rb +16 -1
  36. data/lib/fluent/event.rb +20 -48
  37. data/lib/fluent/event_router.rb +187 -0
  38. data/lib/fluent/filter.rb +32 -0
  39. data/lib/fluent/formatter.rb +29 -101
  40. data/lib/fluent/input.rb +6 -4
  41. data/lib/fluent/label.rb +18 -0
  42. data/lib/fluent/load.rb +1 -3
  43. data/lib/fluent/log.rb +1 -3
  44. data/lib/fluent/match.rb +12 -19
  45. data/lib/fluent/mixin.rb +9 -25
  46. data/lib/fluent/output.rb +27 -45
  47. data/lib/fluent/parser.rb +93 -99
  48. data/lib/fluent/plugin.rb +22 -48
  49. data/lib/fluent/plugin/buf_file.rb +10 -7
  50. data/lib/fluent/plugin/buf_memory.rb +2 -3
  51. data/lib/fluent/plugin/buf_zfile.rb +75 -0
  52. data/lib/fluent/plugin/exec_util.rb +16 -0
  53. data/lib/fluent/plugin/in_debug_agent.rb +2 -3
  54. data/lib/fluent/plugin/in_exec.rb +2 -9
  55. data/lib/fluent/plugin/in_forward.rb +4 -22
  56. data/lib/fluent/plugin/in_gc_stat.rb +2 -3
  57. data/lib/fluent/plugin/in_http.rb +19 -59
  58. data/lib/fluent/plugin/in_monitor_agent.rb +21 -47
  59. data/lib/fluent/plugin/in_object_space.rb +2 -3
  60. data/lib/fluent/plugin/in_status.rb +2 -3
  61. data/lib/fluent/plugin/in_stream.rb +6 -16
  62. data/lib/fluent/plugin/in_syslog.rb +8 -17
  63. data/lib/fluent/plugin/in_tail.rb +17 -24
  64. data/lib/fluent/plugin/in_tcp.rb +16 -0
  65. data/lib/fluent/plugin/in_udp.rb +16 -0
  66. data/lib/fluent/plugin/out_copy.rb +3 -4
  67. data/lib/fluent/plugin/out_exec.rb +2 -4
  68. data/lib/fluent/plugin/out_exec_filter.rb +2 -13
  69. data/lib/fluent/plugin/out_file.rb +5 -6
  70. data/lib/fluent/plugin/out_forward.rb +4 -5
  71. data/lib/fluent/plugin/out_null.rb +2 -3
  72. data/lib/fluent/plugin/out_relabel.rb +26 -0
  73. data/lib/fluent/plugin/out_roundrobin.rb +3 -4
  74. data/lib/fluent/plugin/out_stdout.rb +2 -3
  75. data/lib/fluent/plugin/out_stream.rb +2 -3
  76. data/{test/scripts → lib}/fluent/plugin/out_test.rb +2 -3
  77. data/lib/fluent/plugin/socket_util.rb +19 -10
  78. data/lib/fluent/process.rb +4 -6
  79. data/lib/fluent/registry.rb +16 -0
  80. data/lib/fluent/root_agent.rb +212 -0
  81. data/lib/fluent/status.rb +2 -3
  82. data/lib/fluent/supervisor.rb +33 -54
  83. data/lib/fluent/test.rb +16 -0
  84. data/lib/fluent/test/base.rb +3 -17
  85. data/lib/fluent/test/input_test.rb +52 -7
  86. data/lib/fluent/test/output_test.rb +4 -20
  87. data/lib/fluent/version.rb +17 -1
  88. data/spec/config/config_parser_spec.rb +314 -0
  89. data/spec/config/configurable_spec.rb +524 -0
  90. data/spec/config/configure_proxy_spec.rb +96 -0
  91. data/spec/config/dsl_spec.rb +239 -0
  92. data/spec/config/helper.rb +49 -0
  93. data/spec/config/literal_parser_spec.rb +222 -0
  94. data/spec/config/section_spec.rb +97 -0
  95. data/spec/config/system_config_spec.rb +49 -0
  96. data/test/helper.rb +0 -25
  97. data/test/plugin/test_in_exec.rb +1 -1
  98. data/test/plugin/test_in_forward.rb +2 -1
  99. data/test/plugin/test_in_gc_stat.rb +1 -1
  100. data/test/plugin/test_in_http.rb +3 -78
  101. data/test/plugin/test_in_object_space.rb +1 -1
  102. data/test/plugin/test_in_status.rb +1 -1
  103. data/test/plugin/test_in_stream.rb +2 -1
  104. data/test/plugin/test_in_syslog.rb +2 -1
  105. data/test/plugin/test_in_tail.rb +6 -11
  106. data/test/plugin/test_in_tcp.rb +2 -1
  107. data/test/plugin/test_in_udp.rb +2 -1
  108. data/test/plugin/test_out_copy.rb +1 -12
  109. data/test/plugin/test_out_exec.rb +1 -1
  110. data/test/plugin/test_out_exec_filter.rb +1 -1
  111. data/test/plugin/test_out_file.rb +7 -96
  112. data/test/plugin/test_out_forward.rb +2 -1
  113. data/test/plugin/test_out_roundrobin.rb +1 -12
  114. data/test/plugin/test_out_stdout.rb +1 -1
  115. data/test/plugin/test_out_stream.rb +2 -1
  116. data/test/scripts/fluent/plugin/formatter_known.rb +1 -4
  117. data/test/scripts/fluent/plugin/parser_known.rb +1 -2
  118. data/test/test_config.rb +1 -1
  119. data/test/test_configdsl.rb +2 -1
  120. data/test/test_formatter.rb +3 -395
  121. data/test/test_match.rb +2 -1
  122. data/test/test_mixin.rb +3 -75
  123. data/test/test_output.rb +1 -112
  124. data/test/test_parser.rb +85 -152
  125. metadata +58 -167
  126. data/example/v1_literal_example.conf +0 -36
  127. data/lib/fluent/plugin/in_dummy.rb +0 -103
  128. data/lib/fluent/timezone.rb +0 -131
  129. data/test/config/assertions.rb +0 -42
  130. data/test/config/test_config_parser.rb +0 -389
  131. data/test/config/test_configurable.rb +0 -652
  132. data/test/config/test_configure_proxy.rb +0 -99
  133. data/test/config/test_dsl.rb +0 -237
  134. data/test/config/test_literal_parser.rb +0 -295
  135. data/test/config/test_section.rb +0 -112
  136. data/test/config/test_system_config.rb +0 -99
  137. data/test/config/test_types.rb +0 -63
  138. data/test/plugin/test_in_dummy.rb +0 -95
  139. data/test/test_event.rb +0 -168
  140. data/test/test_input.rb +0 -21
data/lib/fluent/buffer.rb CHANGED
@@ -1,7 +1,5 @@
1
1
  #
2
- # Fluent
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
- synchronize {
227
- @map.each_value {|c|
228
- total += c.size
229
- }
230
- @queue.synchronize {
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
@@ -1,7 +1,5 @@
1
1
  #
2
- # Fluent cat
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.
@@ -1,7 +1,5 @@
1
1
  #
2
- # Fluent
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.
@@ -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['@id'] || conf['id']
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, :final, :param_name, :required, :multi, :alias, :argument, :params, :defaults, :sections
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, "#{self.name}: wrong number of arguments (#{1 + args.length} for #{block ? 2 : 3})"
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, "#{self.name}: both of block and type cannot be specified"
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, "#{self.name}: unknown config_argument type `#{type}'"
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, "#{self.name}: config_argument called twice"
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, "#{self.name}: default value specified twice for #{name}"
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, "#{self.name}: config_section requires block parameter"
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, "#{self.name}: unknown config_section arguments: #{args.inspect}"
148
+ raise ArgumentError, "unknown config_section arguments: #{args.inspect}"
185
149
  end
186
150
 
187
151
  sub_proxy = ConfigureProxy.new(name, *args)
@@ -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
- out << "#{nindent}#{k} #{v}\n"
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)
@@ -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
- spacing_without_comment
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 scan_double_quoted_string
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 scan_double_quoted_string
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 double quoted string"
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
- '"#{' + code + '}"'
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 JSON #{is_array ? 'array' : 'hash'} configuration"
217
+ parse_error! "got incomplete #{is_array ? 'array' : 'hash'} configuration"
236
218
  end
237
219
 
238
220
  JSON.dump(result)