Skip to content

Commit 236d87d

Browse files
authored
Merge pull request #4482 from fluent/handle-specical-log_level-element
config: yaml_parser: Handle $log_level element for special case
2 parents 0c42b26 + e2abe25 commit 236d87d

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/fluent/config/yaml_parser/parser.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ def section_build(name, config, indent: 0, arg: nil)
138138
sb.add_line('@id', v)
139139
end
140140

141+
if (v = config.delete('$log_level'))
142+
sb.add_line('@log_level', v)
143+
end
144+
141145
config.each do |key, val|
142146
if val.is_a?(Array)
143147
val.each do |v|

test/test_config.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ def test_included
167167
tag: tag.dummy
168168
- source:
169169
$type: tcp
170+
$log_level: info
170171
tag: tag.tcp
171172
parse:
172173
$arg:
@@ -176,6 +177,7 @@ def test_included
176177
- match:
177178
$tag: tag.*
178179
$type: stdout
180+
$log_level: debug
179181
buffer:
180182
$type: memory
181183
flush_interval: 1s
@@ -208,10 +210,12 @@ def test_included
208210
'tag.dummy',
209211
'tcp',
210212
'tag.tcp',
213+
'info',
211214
'none',
212215
'why.parse.section.doesnot.have.arg,huh',
213216
'stdout',
214217
'tag.*',
218+
'debug',
215219
'null',
216220
'**',
217221
'@FLUENT_LOG',
@@ -224,10 +228,12 @@ def test_included
224228
dummy_source_conf['tag'],
225229
tcp_source_conf['@type'],
226230
tcp_source_conf['tag'],
231+
tcp_source_conf['@log_level'],
227232
parse_tcp_conf['@type'],
228233
parse_tcp_conf.arg,
229234
match_conf['@type'],
230235
match_conf.arg,
236+
match_conf['@log_level'],
231237
fluent_log_conf['@type'],
232238
fluent_log_conf.arg,
233239
label_conf.arg,

0 commit comments

Comments
 (0)