diff --git a/lib/fluent/config/yaml_parser/parser.rb b/lib/fluent/config/yaml_parser/parser.rb index dc1caaf46d..862f774802 100644 --- a/lib/fluent/config/yaml_parser/parser.rb +++ b/lib/fluent/config/yaml_parser/parser.rb @@ -138,6 +138,10 @@ def section_build(name, config, indent: 0, arg: nil) sb.add_line('@id', v) end + if (v = config.delete('$log_level')) + sb.add_line('@log_level', v) + end + config.each do |key, val| if val.is_a?(Array) val.each do |v| diff --git a/test/test_config.rb b/test/test_config.rb index 24f63830d4..7533e6e16b 100644 --- a/test/test_config.rb +++ b/test/test_config.rb @@ -167,6 +167,7 @@ def test_included tag: tag.dummy - source: $type: tcp + $log_level: info tag: tag.tcp parse: $arg: @@ -176,6 +177,7 @@ def test_included - match: $tag: tag.* $type: stdout + $log_level: debug buffer: $type: memory flush_interval: 1s @@ -208,10 +210,12 @@ def test_included 'tag.dummy', 'tcp', 'tag.tcp', + 'info', 'none', 'why.parse.section.doesnot.have.arg,huh', 'stdout', 'tag.*', + 'debug', 'null', '**', '@FLUENT_LOG', @@ -224,10 +228,12 @@ def test_included dummy_source_conf['tag'], tcp_source_conf['@type'], tcp_source_conf['tag'], + tcp_source_conf['@log_level'], parse_tcp_conf['@type'], parse_tcp_conf.arg, match_conf['@type'], match_conf.arg, + match_conf['@log_level'], fluent_log_conf['@type'], fluent_log_conf.arg, label_conf.arg,