# File lib/fluent/plugin/output.rb, line 538 def initialize(name, str, type, arg) @name = name @string = str @type = type raise ArgumentError, "invalid type:#{type}" if @type != :time && @type != :tag && @type != :keys @argument = arg end
# File lib/fluent/plugin/output.rb, line 554 def keys? @type == :keys end
# File lib/fluent/plugin/output.rb, line 550 def tag? @type == :tag end
# File lib/fluent/plugin/output.rb, line 546 def time? @type == :time end
# File lib/fluent/plugin/output.rb, line 558 def validate! case @type when :time then validate_time! when :tag then validate_tag! when :keys then validate_keys! end end
# File lib/fluent/plugin/output.rb, line 593 def validate_keys! keys = @argument[:keys] chunk_keys = @argument[:chunkkeys] if (chunk_keys - keys).size > 0 not_specified = (chunk_keys - keys).sort raise Fluent::ConfigError, "Parameter '#{@name}' doesn't have enough placeholders for keys #{not_specified.join(',')}" end if (keys - chunk_keys).size > 0 not_satisfied = (keys - chunk_keys).sort raise Fluent::ConfigError, "Parameter '#{@name}' has placeholders, but chunk keys doesn't have keys #{not_satisfied.join(',')}" end end
# File lib/fluent/plugin/output.rb, line 582 def validate_tag! parts = @argument[:parts] tagkey = @argument[:tagkey] if tagkey && parts.empty? raise Fluent::ConfigError, "Parameter '#{@name}' doesn't have tag placeholder" end if !tagkey && !parts.empty? raise Fluent::ConfigError, "Parameter '#{@name}' has tag placeholders, but chunk key 'tag' is not configured" end end
# File lib/fluent/plugin/output.rb, line 566 def validate_time! sec = @argument[:sec] title = @argument[:title] example = @argument[:example] timekey = @argument[:timekey] if !sec && timekey raise Fluent::ConfigError, "Parameter '#{name}' doesn't have timestamp placeholders for timekey #{timekey.to_i}" end if sec && !timekey raise Fluent::ConfigError, "Parameter '#{name}' has timestamp placeholders, but chunk key 'time' is not configured" end if sec && timekey && timekey < sec raise Fluent::ConfigError, "Parameter '#{@name}' doesn't have timestamp placeholder for #{title}('#{example}') for timekey #{timekey.to_i}" end end