class Fluent::Plugin::KubEventsTimestampFilter
Public Instance Methods
configure(conf)
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_kube_events_timestamp.rb, line 19 def configure(conf) super require 'date' @strftime_format = "%Y-%m-%dT%H:%M:%S.%3N%z".freeze raise Fluent::ConfigError, "mapped_time_key can not be empty" if mapped_time_key.to_s.empty? raise Fluent::ConfigError, "timestamp_fields must have 3 items" if timestamp_fields.length != 3 end
filter(tag, time, record)
click to toggle source
# File lib/fluent/plugin/filter_kube_events_timestamp.rb, line 35 def filter(tag, time, record) vals=@timestamp_fields.map do |field|; getin(record, field); end record[@mapped_time_key] = (vals[0].to_s.empty?) ? (vals[1].to_s.empty?) ? vals[2] : vals[1] : vals[0] # record[@mapped_time_key] = (getin(record,@timestamp_fields[0]).to_s.empty?) ? (getin(record,@timestamp_fields[1]).to_s.empty?) ? getin(record,@timestamp_fields[2]) : getin(record,@timestamp_fields[1]) : getin(record,@timestamp_fields[0]) if record[@mapped_time_key].to_s.empty? record[@mapped_time_key] = Time.at(time.is_a?(Fluent::EventTime) ? time.to_int : time).strftime(@strftime_format) end $log.debug("Timestamp added: #{@mapped_time_key}:#{record[@mapped_time_key]}") record end
shutdown()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_kube_events_timestamp.rb, line 31 def shutdown super end
start()
click to toggle source
Calls superclass method
# File lib/fluent/plugin/filter_kube_events_timestamp.rb, line 27 def start super end