-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Log spam #1377
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
Comments
I just noticed that too, after discovering a shocking 160 million log lines generated (and ingested into Loki) in a mere week. Somewhat surprised that there is no way to revert this behavior so have opted in for pinning the previous version of the chart for now. I understand the motivation behind the logging library change but that should be a breaking change (or a massive warning in the release notes) if you ask me. |
CC @tjhop care to look into this one? |
Immediate fix for prometheus#1377. This fix will need to be refactored a bit when we upgrade prometheus/common to v0.63.0, since prometheus/common#754 contains a breaking change to promslog's level code. Explanation: When I ported the blackbox exporter to use slog in prometheus#1311, I removed the `none` option from the log prober flag, as it was non-standard to other prometheus projects, not a valid value in the original promlog package, and slog has no inherent corresponding concept. The log prober flag value is used to create the scrape logger (which is specifically used for scrape-related logging, not overall application logging). I also included some code that ensured a level config would be created for use with the scrape logger. In combination, this causes the blackbox exporter to always output scrape logs, which can be noisy. If we instead default the flag to an empty string and do some intelligent handling of an nil log prober value within the scrapeLogger's implementation of the slog.Handler interface, then we can restore the previous behavior. TL;DR: Leave `--log.prober` flag unset and it won't do scrape-level logging Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
Immediate fix for prometheus#1377. This fix will need to be refactored a bit when we upgrade prometheus/common to v0.63.0, since prometheus/common#754 contains a breaking change to promslog's level code. Explanation: When I ported the blackbox exporter to use slog in prometheus#1311, I removed the `none` option from the log prober flag, as it was non-standard to other prometheus projects, not a valid value in the original promlog package, and slog has no inherent corresponding concept. The log prober flag value is used to create the scrape logger (which is specifically used for scrape-related logging, not overall application logging). I also included some code that ensured a level config would be created for use with the scrape logger. In combination, this causes the blackbox exporter to always output scrape logs, which can be noisy. If we instead default the flag to an empty string and do some intelligent handling of an nil log prober value within the scrapeLogger's implementation of the slog.Handler interface, then we can restore the previous behavior. TL;DR: Leave `--log.prober` flag unset and it won't do scrape-level logging Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
@Jakob3xD I agree with your interpretation of where error should be used. I'm hesitant to re-introduce the By defaulting the flag to an empty string and improving how things are handled when unset, I believe I was able to restore the previously expected behavior. As mentioned in the linked PR:
Opinions? |
I agree, I don't think we want to re-introduce the
I think this isn't working as intended. The default value for Also, the default value for |
Am I misunderstanding what the purpose of the
|
I can do that. Should the behavior of |
isn't debug mode generally a 'catch all'? If I set this flag to 'warn' it stops the info logging for sure. this is unique to v0.26.0 release. I would think default should not be info. |
I think you might be confused about how log levels work. You need to change to a higher level to not see these. Changing to debug still included info.
|
@SuperQ can you clarify for us what the expected behaviour of From your comment, I would assume that you expect the If this is correct, then this would IMO not be a good solution for the problem, as we lose the use of levels for probe logs. Specially because those levels are requested by other issues, see #1401. From what I have read so far, I see two solutions.
Option 1 allows a finer filtering of logs as the exporter logs and probe logs are separated where option 2 removes the confusing extra argument. |
Yea, I don't know what the original intention of I feel like it was just hacked in based on how the old logging library worked. |
Based on discussion in prometheus#1377, slack, etc, it seems unclear what the intended functionality/behavior of the probe scrape logger was supposed to be. This is an attempt to align behavior with current user expectations. The improved defaults and updated configs here should address the log spam as well. User facing changes: - the `--log.prober` flag now sets the _level at which prober scrape logs will be emitted at_. - the `--log.prober` flag now defaults to `debug` level. Because the default log level is info, this means that in order to see probe scrape logs, a user must either: - increase the level of the logger via `--log.level` to be >= that of `--log.prober` (ie, set both to `debug`) - decrease the level of the probe logger via `--log.prober` to be <= that of `--log.level` (ie, set both to `info`) Note: This approach (emitting all logs from the probe logger at the level specified) involves hijacking calls to the logger and overriding the level. This comes with the very obvious side effect that the developers working on code using the probe scrape logger no longer have control over the control over the level of the log that gets emitted. Regardless of whether they use `l.Info()` or `l.Debug()`, it'll still get logged at the configured log prober level. This approach likely would not be compatible with some of the other discussions around how probe scrape logs work, like prometheus#1401. Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
After some more thought and discussion with @SuperQ on slack, I updated #1381 based on our current best understanding of how the More details in the PR, feedback welcome 👍 |
* fix: stop scrape logger spam, refactor scrape logger design Based on discussion in #1377, slack, etc, it seems unclear what the intended functionality/behavior of the probe scrape logger was supposed to be. This is an attempt to align behavior with current user expectations. The improved defaults and updated configs here should address the log spam as well. User facing changes: - the `--log.prober` flag now sets the _level at which prober scrape logs will be emitted at_. - the `--log.prober` flag now defaults to `debug` level. Because the default log level is info, this means that in order to see probe scrape logs, a user must either: - increase the level of the logger via `--log.level` to be >= that of `--log.prober` (ie, set both to `debug`) - decrease the level of the probe logger via `--log.prober` to be <= that of `--log.level` (ie, set both to `info`) Note: This approach (emitting all logs from the probe logger at the level specified) involves hijacking calls to the logger and overriding the level. This comes with the very obvious side effect that the developers working on code using the probe scrape logger no longer have control over the control over the level of the log that gets emitted. Regardless of whether they use `l.Info()` or `l.Debug()`, it'll still get logged at the configured log prober level. This approach likely would not be compatible with some of the other discussions around how probe scrape logs work, like #1401. Signed-off-by: TJ Hoplock <t.hoplock@gmail.com> * docs(README): add section on --log.prober behavior with sample output Address PR feedback Signed-off-by: TJ Hoplock <t.hoplock@gmail.com> --------- Signed-off-by: TJ Hoplock <t.hoplock@gmail.com>
Hello,
we updated our blackbox exporter and are now getting a lot of log messages due to the current implementation of slog introduced with #1311 as it removes the default
none
logging option.We have tens of thousands of probes running each minute. Some of them are expected to fail but will cause the logger to print an error message. We are now producing over 14k of logs per second.
I can see two possible solutions for this where I prefer the first one.
1. Adjust the log level for some message
Currently, a probe failure is logged with level ERROR. IMO this should be level DEBUG (or WARN). My interpretation of level ERROR is that blackbox exporter itself is having an issue. Like failed to read config file, failed to unmarshal config file, failed binding to port. Things that are real issues. A failing probe can have different reasons, but does not affect the blackbox exporter.
2. Add back the
none
logging optionAdd the
none
option by writing logs toio.Discard
like inNewNopLogger()
.Instead, it would also be possible to add a flag to define where to write the logs. For example stderr, stdout, /dev/null.
The text was updated successfully, but these errors were encountered: