23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
# File 'lib/fluent/plugin/kubernetes_metadata_util.rb', line 23
def create_time_from_record(record, internal_time)
time_key = @time_fields.detect { |ii| record.key?(ii) }
time = record[time_key]
if time.nil? || time.is_a?(String) && time.chop.empty?
return Time.at(internal_time.to_f)
end
if ['_SOURCE_REALTIME_TIMESTAMP', '__REALTIME_TIMESTAMP'].include?(time_key)
timei = time.to_i
return Time.at(timei / 1_000_000, timei % 1_000_000)
end
return Time.at(time) if time.is_a?(Numeric)
Time.parse(time)
end
|