Skip to content

Commit

Permalink
Merge pull request fluent#4482 from fluent/handle-specical-log_level-…
Browse files Browse the repository at this point in the history
…element

config: yaml_parser: Handle $log_level element for special case
  • Loading branch information
ashie authored May 2, 2024
2 parents 0c42b26 + e2abe25 commit 236d87d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/fluent/config/yaml_parser/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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|
Expand Down
6 changes: 6 additions & 0 deletions test/test_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ def test_included
tag: tag.dummy
- source:
$type: tcp
$log_level: info
tag: tag.tcp
parse:
$arg:
Expand All @@ -176,6 +177,7 @@ def test_included
- match:
$tag: tag.*
$type: stdout
$log_level: debug
buffer:
$type: memory
flush_interval: 1s
Expand Down Expand Up @@ -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',
Expand All @@ -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,
Expand Down

0 comments on commit 236d87d

Please sign in to comment.