lib/fluent/plugin/out_yohoushi.rb in fluent-plugin-yohoushi-0.0.4 vs lib/fluent/plugin/out_yohoushi.rb in fluent-plugin-yohoushi-0.0.5
- old
+ new
@@ -168,11 +168,11 @@
class PlaceholderExpander
attr_reader :placeholders
def prepare_placeholders(time, record, opts)
- placeholders = { '${time}' => time.to_s }
+ placeholders = { '${time}' => Time.at(time).to_s }
record.each {|key, val| placeholders.store("${#{key}}", val) }
opts.each do |key, val|
if val.kind_of?(Array)
size = val.size
@@ -204,10 +204,10 @@
# @param [Time] time the time
# @param [Hash] record the record
# @param [Hash] opts others
def prepare_placeholders(time, record, opts)
struct = UndefOpenStruct.new(record)
- struct.time = time
+ struct.time = Time.at(time)
opts.each {|key, val| struct.__send__("#{key}=", val) }
@placeholders = struct
end
# Replace placeholders in a string