lib/fluent/plugin/out_tdlog.rb in fluent-plugin-td-0.10.28 vs lib/fluent/plugin/out_tdlog.rb in fluent-plugin-td-0.10.29

- old
+ new

@@ -1,6 +1,7 @@ require 'td-client' +require 'fluent/output' require 'fluent/plugin/td_plugin_version' module Fluent class TreasureDataLogOutput < BufferedOutput Plugin.register_output('tdlog', self) @@ -19,11 +20,10 @@ config_param :endpoint, :string, :default => TreasureData::API::NEW_DEFAULT_ENDPOINT config_param :use_ssl, :bool, :default => true config_param :connect_timeout, :integer, :default => nil config_param :read_timeout, :integer, :default => nil config_param :send_timeout, :integer, :default => nil - config_set_default :buffer_type, 'file' config_set_default :flush_interval, 300 def initialize require 'fileutils' require 'tempfile' @@ -43,24 +43,29 @@ @empty_gz_data = TreasureData::API.create_empty_gz_data @user_agent = "fluent-plugin-td: #{TreasureDataPlugin::VERSION}".freeze end def configure(conf) + # overwrite default value of buffer_chunk_limit + unless conf.has_key?('buffer_chunk_limit') + conf['buffer_chunk_limit'] = IMPORT_SIZE_LIMIT + end + + # v0.14 seems to have a bug of config_set_default: https://github.com/treasure-data/fluent-plugin-td/pull/22#issuecomment-230782005 + unless conf.has_key?('buffer_type') + conf['buffer_type'] = 'file' + end + super if @use_gzip_command require 'open3' begin Open3.capture3("gzip -V") rescue Errno::ENOENT raise ConfigError, "'gzip' utility must be in PATH for use_gzip_command parameter" end - end - - # overwrite default value of buffer_chunk_limit - if !conf['buffer_chunk_limit'] - @buffer.buffer_chunk_limit = IMPORT_SIZE_LIMIT end if conf.has_key?('tmpdir') @tmpdir = conf['tmpdir'] FileUtils.mkdir_p(@tmpdir)