Support label paramter

Signed-off-by: Kenji Okimoto <okimoto@clear-code.com>
This commit is contained in:
Kenji Okimoto 2018-09-13 11:21:52 +09:00
parent 6ac186edb5
commit 7615eaeb0b
No known key found for this signature in database
GPG Key ID: F9E3E329A5C5E4A1

View File

@ -40,6 +40,10 @@ class Fluentd
end
_attributes = { "@type" => self.plugin_name }.merge(_attributes)
_attributes["@log_level"] = _attributes.delete("log_level")
label = _attributes.delete("label")
if plugin_type == "input"
_attributes["@label"] = label
end
argument = case plugin_type
when "output", "filter", "buffer"
_attributes.delete(self._argument_name.to_s) || ""
@ -47,7 +51,14 @@ class Fluentd
""
end
attrs, elements = parse_attributes(_attributes)
config_element(name, argument, attrs, elements)
case plugin_type
when "output", "filter"
# e is <match> or <filter>
e = config_element(name, argument, attrs, elements)
config_element("label", label, {}, [e])
else
config_element(name, argument, attrs, elements)
end
end
def parse_attributes(attributes)