class Fluent::Compat::TimeSlicedOutput
Private Class Methods
new()
click to toggle source
Calls superclass method
Fluent::Plugin::Output.new
# File lib/fluent/compat/output.rb, line 586 def initialize super @localtime = true unless self.class.ancestors.include?(Fluent::Compat::CallSuperMixin) self.class.prepend Fluent::Compat::CallSuperMixin end end
propagate_default_params()
click to toggle source
# File lib/fluent/compat/output.rb, line 595 def self.propagate_default_params BUFFER_PARAMS end
Private Instance Methods
configure(conf)
click to toggle source
Calls superclass method
Fluent::Plugin::Output#configure
# File lib/fluent/compat/output.rb, line 600 def configure(conf) bufconf = CompatOutputUtils.buffer_section(conf) config_style = (bufconf ? :v1 : :v0) if config_style == :v0 buf_params = { "flush_mode" => (conf['flush_interval'] ? "interval" : "lazy"), "retry_type" => "exponential_backoff", } BUFFER_PARAMS.each do |older, newer| next unless newer if conf.has_key?(older) if older == 'buffer_queue_full_action' && conf[older] == 'exception' buf_params[newer] = 'throw_exception' else buf_params[newer] = conf[older] end end end if conf['timezone'] @timezone = conf['timezone'] Fluent::Timezone.validate!(@timezone) elsif conf['utc'] @timezone = "+0000" @localtime = false elsif conf['localtime'] @timezone = Time.now.strftime('%z') @localtime = true else @timezone = "+0000" # v0.12 assumes UTC without any configuration @localtime = false end @_timekey = case conf['time_slice_format'] when /\%S/ then 1 when /\%M/ then 60 when /\%H/ then 3600 when /\%d/ then 86400 when nil then 86400 # default value of TimeSlicedOutput.time_slice_format is '%Y%m%d' else raise Fluent::ConfigError, "time_slice_format only with %Y or %m is too long" end buf_params["timekey"] = @_timekey conf.elements << Fluent::Config::Element.new('buffer', 'time', buf_params, []) end ParserUtils.convert_parser_conf(conf) FormatterUtils.convert_formatter_conf(conf) super if config_style == :v1 if @buffer_config.chunk_keys == ['tag'] raise Fluent::ConfigError, "this plugin '#{self.class}' allows <buffer tag> only" end end self.extend TimeSliceChunkMixin end
extract_placeholders(str, metadata)
click to toggle source
format MUST be implemented in plugin write is also
# File lib/fluent/compat/output.rb, line 679 def extract_placeholders(str, metadata) raise "BUG: compat plugin does not support extract_placeholders: use newer plugin API" end
start()
click to toggle source
Calls superclass method
Fluent::Plugin::Output#start
# File lib/fluent/compat/output.rb, line 661 def start super if instance_variable_defined?(:@formatter) && @inject_config unless @formatter.class.ancestors.include?(Fluent::Compat::HandleTagAndTimeMixin) if @formatter.respond_to?(:owner) && !@formatter.owner @formatter.owner = self @formatter.singleton_class.prepend FormatterUtils::InjectMixin end end end end
support_in_v12_style?(feature)
click to toggle source
# File lib/fluent/compat/output.rb, line 535 def support_in_v12_style?(feature) case feature when :synchronous then false when :buffered then true when :delayed_commit then false when :custom_format then true end end