You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* 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>
Copy file name to clipboardExpand all lines: README.md
+117Lines changed: 117 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,123 @@ using the `--web.config.file` parameter. The format of the file is described
50
50
Note that the TLS and basic authentication settings affect all HTTP endpoints:
51
51
/metrics for scraping, /probe for probing, and the web UI.
52
52
53
+
### Controlling log level for probe logs
54
+
55
+
It is possible to control the level at which probe logs related to a scrape are output as.
56
+
57
+
Probe logs default to `debug` level, and can be controlled by the `--log.prober` flag.
58
+
This means that probe scrape logs will not be output unless the level configured for the probe logger via `--log.prober` is >= the level configured for the blackbox_exporter via `--log.level`.
59
+
60
+
Sample output demonstrating the use and effect of these flags can be seen below.
61
+
62
+
> _Note_
63
+
>
64
+
> All log samples below used the following basic `blackbox.yml` configuration file and contain the probe logs of a single scrape generated by `curl`
time=2025-05-21T04:12:13.860Z level=INFO source=handler.go:194 msg="Address does not match first address, not sending TLS ServerName" module=http_2xx target=prometheus.io first=172.67.201.240 address=prometheus.io
time=2025-05-21T04:13:23.202Z level=INFO source=handler.go:194 msg="Address does not match first address, not sending TLS ServerName" module=http_2xx target=prometheus.io first=104.21.60.220 address=prometheus.io
time=2025-05-21T04:15:03.089Z level=DEBUG source=handler.go:194 msg="Address does not match first address, not sending TLS ServerName" module=http_2xx target=prometheus.io first=172.67.201.240 address=prometheus.io
timeoutOffset=kingpin.Flag("timeout-offset", "Offset to subtract from timeout in seconds.").Default("0.5").Float64()
52
52
configCheck=kingpin.Flag("config.check", "If true validate the config file and then exit.").Default().Bool()
53
-
logLevelProber=kingpin.Flag("log.prober", "Log level from probe requests. One of: [debug, info, warn, error]").Default("info").String()
53
+
logLevelProber=kingpin.Flag("log.prober", "Log level for probe request logs. One of: [debug, info, warn, error]. Defaults to debug. Please see the section `Controlling log level for probe logs` in the project README for more information.").Default("debug").String()
54
54
historyLimit=kingpin.Flag("history.limit", "The maximum amount of items to keep in the history.").Default("100").Uint()
55
55
externalURL=kingpin.Flag("web.external-url", "The URL under which Blackbox exporter is externally reachable (for example, if Blackbox exporter is served via a reverse proxy). Used for generating relative and absolute links back to Blackbox exporter itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Blackbox exporter. If omitted, relevant URL components will be derived automatically.").PlaceHolder("<url>").String()
56
56
routePrefix=kingpin.Flag("web.route-prefix", "Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url.").PlaceHolder("<path>").String()
0 commit comments