Method: Fluent::Plugin::SecondaryFileOutput#configure

Defined in:
lib/fluent/plugin/out_secondary_file.rb

#configure(conf) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/fluent/plugin/out_secondary_file.rb', line 36

def configure(conf)
  super

  unless @as_secondary
    raise Fluent::ConfigError, "This plugin can only be used in the <secondary> section"
  end

  if @basename.include?("/")
    raise Fluent::ConfigError, "basename should not include `/`"
  end

  @path_without_suffix = File.join(@directory, @basename)
  validate_compatible_with_primary_buffer!(@path_without_suffix)

  @suffix = case @compress
            when :text
              ""
            when :gzip
              ".gz"
            end

  test_path = @path_without_suffix
  unless Fluent::FileUtil.writable_p?(test_path)
    raise Fluent::ConfigError, "out_secondary_file: `#{@directory}` should be writable"
  end

  @dir_perm = system_config.dir_permission || Fluent::DEFAULT_DIR_PERMISSION
  @file_perm = system_config.file_permission || Fluent::DEFAULT_FILE_PERMISSION
end