diff --git a/app/models/concerns/fluentd/setting/plugin_config.rb b/app/models/concerns/fluentd/setting/plugin_config.rb index 6ebfb62..393552e 100644 --- a/app/models/concerns/fluentd/setting/plugin_config.rb +++ b/app/models/concerns/fluentd/setting/plugin_config.rb @@ -72,7 +72,7 @@ class Fluentd end elements = section_params.map do |index, _section_params| section_class.new(_section_params).to_config - end + end.compact end attrs = params.to_h.reject do |key, value| skip?(key.to_sym, value) diff --git a/app/models/concerns/fluentd/setting/section_config.rb b/app/models/concerns/fluentd/setting/section_config.rb index 2bb74a8..13b54e5 100644 --- a/app/models/concerns/fluentd/setting/section_config.rb +++ b/app/models/concerns/fluentd/setting/section_config.rb @@ -11,7 +11,9 @@ class Fluentd end argument = _attributes.delete(self._argument_name.to_s) || "" attrs, elements = parse_attributes(_attributes) - config_element(section_name, argument, attrs, elements) + if attrs.present? || elements.present? + config_element(section_name, argument, attrs, elements) + end end def parse_attributes(attributes)