log: add system_config option to force stacktrace level #5008
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Which issue(s) this PR fixes:
None.
What this PR does / why we need it:
What this PR does
Add a new system_config option:
forced_stacktrace_level
.system/log/forced_stacktrace_level
enum
none
,trace
,debug
,info
,warn
,error
,fatal
none
By default, the behavior of Fluentd does not change.
So, this does not affect existing users.
If you set this option and change the value, the log levels of stacktraces are forced to that value.
Stacktraces that do not meet the log level are discarded in advance.
After the log level is changed, it is judged again for logging or discarded finally.
For example, by default (
log_level info
), ...trace
/debug
stacktraces are not logged regardless of this option.forced_stacktrace_level debug
, then all stacktraces are not logged.This is because we should avoid logging logs that contradict
log_level
, and to avoid unexpectedly logging logs that are initiallytrace
/debug
level.Setting example:
why we need it
To make it easier to exclude stacktraces from monitoring Fluentd's own logs.
For example, there could be a system that raises an alert when an error-level log is detected.
You may want to exclude some error-level logs from the detection.
However, if stacktraces are logged at error level, you need to exclude those stacktraces as well.
With the current specification, that is troublesome.
Ideally, it would be preferable to exclude all stacktraces from the detection.
It is sufficient to have access to stacktraces when investigating the details.
An easy way to improve the current situation is this feature.
If you are detecting error logs as in the previous example, you can easily exclude all stacktraces from the detection by forcing the stacktrace level to
info
with this feature.Docs Changes:
TODO
Release Note:
System configuration: Add
forced_stacktrace_level
to force the log level of stacktraces.Sample:
Without
forced_stacktrace_level info
:With
forced_stacktrace_level info
:TODO: