Class: Fluent::Compat::TextParser::ValuesParser
Constant Summary
Fluent::Compat::TypeConverter::Converters
Instance Method Summary
collapse
included
Instance Method Details
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
|
# File 'lib/fluent/compat/parser.rb', line 191
def configure(conf)
super
if @time_key && !@keys.include?(@time_key) && @estimate_current_event
raise Fluent::ConfigError, "time_key (#{@time_key.inspect}) is not included in keys (#{@keys.inspect})"
end
if @time_format && !@time_key
raise Fluent::ConfigError, "time_format parameter is ignored because time_key parameter is not set. at #{conf.inspect}"
end
@time_parser = time_parser_create
if @null_value_pattern
@null_value_pattern = Regexp.new(@null_value_pattern)
end
@mutex = Mutex.new
end
|
#values_map(values) ⇒ Object
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
# File 'lib/fluent/compat/parser.rb', line 211
def values_map(values)
record = Hash[keys.zip(values.map { |value| convert_value_to_nil(value) })]
if @time_key
value = @keep_time_key ? record[@time_key] : record.delete(@time_key)
time = if value.nil?
if @estimate_current_event
Fluent::EventTime.now
else
nil
end
else
@mutex.synchronize { @time_parser.parse(value) }
end
elsif @estimate_current_event
time = Fluent::EventTime.now
else
time = nil
end
convert_field_type!(record) if @type_converters
return time, record
end
|