Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: yaml_parser: Handle $log_level element for special case #4482

Merged
merged 1 commit into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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