lib/fluent/plugin/in_tail.rb in fluentd-0.14.22.rc1 vs lib/fluent/plugin/in_tail.rb in fluentd-0.14.22.rc2
- old
+ new
@@ -85,10 +85,12 @@
desc 'Ignore repeated permission error logs'
config_param :ignore_repeated_permission_error, :bool, default: false
attr_reader :paths
+ @@pos_file_paths = {}
+
def configure(conf)
compat_parameters_convert(conf, :parser)
parser_config = conf.elements('parse').first
unless parser_config
raise Fluent::ConfigError, "<parse> section is required."
@@ -107,10 +109,16 @@
if @paths.empty?
raise Fluent::ConfigError, "tail: 'path' parameter is required on tail input"
end
# TODO: Use plugin_root_dir and storage plugin to store positions if available
- unless @pos_file
+ if @pos_file
+ if @@pos_file_paths.has_key?(@pos_file) && !called_in_test?
+ plugin_id_using_this_path = @@pos_file_paths[@pos_file]
+ raise Fluent::ConfigError, "Other 'in_tail' plugin already use same pos_file path: plugin_id = #{plugin_id_using_this_path}, pos_file path = #{@pos_file}"
+ end
+ @@pos_file_paths[@pos_file] = self.plugin_id
+ else
$log.warn "'pos_file PATH' parameter is not set to a 'tail' source."
$log.warn "this parameter is highly recommended to save the position to resume tailing."
end
configure_tag