Repository navigation
Loki: option to disable stats.grafana.org telemetry #8210
Description
Loki, the log storage app of NethServer 8, periodically sends anonymous usage statistics to stats.grafana.org. When the network uses a DNS (Domain Name System) blocker like Pi-hole that blocks this name, Loki keeps retrying the failed lookup at a very high rate, and Pi-hole users see thousands of queries for stats.grafana.org coming from the NethServer 8 node.
Usage statistics are already disabled in the Alloy log collector (the promtail.service unit) by NethServer/ns8-core@d839475 (NethServer/ns8-core#1230). Loki still sends them, and an upstream bug (grafana/loki#10648) reports that Loki may contact stats.grafana.org even when usage reporting is disabled in its configuration.
The purpose of this feature is to let the administrator stop this traffic with a manual configuration. The default behavior does not change: without manual configuration, Loki keeps sending usage statistics as it does now.
Proposed solution
Add two environment variables to the Loki app:
LOKI_REPORTING_ENABLED(defaulttrue): when set tofalse, disables the Loki usage reporting (analytics.reporting_enabledin the Loki configuration)PODMAN_POD_OPTS(default empty): extra options for thepodman pod createcommand of the Loki pod. For example,--add-host=stats.grafana.org:127.0.0.1resolvesstats.grafana.orgto the loopback address inside the pod, so connection attempts fail immediately without leaving the node. This works around the upstream bug.
Document in the README how to set the variables with runagent and restart the service.
Alternative solutions
- Add a fake
stats.grafana.orgrecord to/etc/hostson the node, as suggested in the community. It affects the whole node, not only Loki. - Point
stats.grafana.orgto an unreachable address (for example a documentation range). Each connection attempt would hang until a timeout instead of failing immediately, so the loopback address is preferred. - Disable usage reporting by default. Not proposed for now, to keep the current behavior unchanged.
Additional context
Affected component: Loki 1.5.1
See also
- https://community.nethserver.org/t/if-metrics-and-grafana-are-disabled-there-should-be-zero-traffic-to-grafana-dot-org-period/29040
- https://community.nethserver.org/t/anyone-else-having-connection-issues-with-grafana-dot-org/27147
- https://community.nethserver.org/t/ns8-stats-grafana-org/25252
- Loki Reports to stats.grafana.org despite
analytics.reporting_enabled: falsegrafana/loki#10648
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
[-]Loki floods DNS with stats.grafana.org lookups[/-][+]Loki: option to disable stats.grafana.org telemetry[/+]DavidePrincipi commentedon Oct 8, 2026
QA
Test images:
ghcr.io/nethserver/loki:1.5.2-dev.1andghcr.io/nethserver/metrics:1.5.1-dev.1. The commands assume the default instancesloki1andmetrics1.Loki
LOKI_REPORTING_ENABLED=false, and Loki starts normally.stats.grafana.orgto the loopback address inside the pod:127.0.0.1 stats.grafana.org.runagent -m loki1 python3 -c 'import agent ; agent.munset_env(["LOKI_REPORTING_ENABLED", "PODMAN_POD_OPTS"])' runagent -m loki1 systemctl --user restart loki.serviceMetrics (Grafana)
Grafana must be enabled (
grafana_pathset).GF_ANALYTICS_CHECK_FOR_UPDATES=falseandGF_ANALYTICS_CHECK_FOR_PLUGIN_UPDATES=false. Dashboards load as before.GF_ANALYTICS_REPORTING_ENABLED=falseis listed too.runagent -m metrics1 python3 -c 'import agent ; agent.unset_env("PODMAN_RUN_OPTS")' runagent -m metrics1 systemctl --user restart grafana.serviceNote: we couldn't reproduce the DNS query flood in the lab. With a simulated Pi-hole, Loki made no lookups for
stats.grafana.orgin 14 minutes after a restart. These steps check that the settings are applied. If you have a node behind Pi-hole, compare its query counts before and after the change.DavidePrincipi commentedon Oct 8, 2026
Already released https://github.com/NethServer/ns8-metrics/releases/tag/1.5.1
DavidePrincipi commentedon Oct 14, 2026
Test results
Test setup: a single-node cluster (Rocky Linux 9) with the ns8-dnsmasq module acting like Pi-hole. Its DNS records answer
0.0.0.0and::forstats.grafana.organdgrafana.com(Pi-hole's default blocking mode), andlog-queriesrecords every request. The node itself uses dnsmasq as its DNS server.stats.grafana.orgDNS queriesLOKI_REPORTING_ENABLED=falsePODMAN_POD_OPTS=--add-host=stats.grafana.org:127.0.0.1PODMAN_RUN_OPTS=-e GF_ANALYTICS_REPORTING_ENABLED=falseNotes:
LOKI_REPORTING_ENABLED=false: Loki's/configendpoint showsanalytics.reporting_enabled: false. With Loki 3.7.8, the upstream issue Loki Reports to stats.grafana.org despiteanalytics.reporting_enabled: falsegrafana/loki#10648 (reports sent despite this setting) did not show up during the test.--add-host: Loki keeps retrying, but only inside its pod. A traffic capture on the pod loopback interface showed about one connection to127.0.0.1:443every 12 seconds, each refused immediately, with no DNS query and no traffic leaving the node.0.0.0.0makes Grafana, which uses host networking, connect to the node's own Traefik on port 443 and fail the certificate check, which is harmless.grafana.comlookups on every start, from its plugin preinstall feature. This is addressed separately in feat: Grafana image with bundled plugins only ns8-metrics#99.DavidePrincipi commentedon Oct 14, 2026
QA: metrics 1.6.0-dev.2
Test image:
ghcr.io/nethserver/metrics:1.6.0-dev.2(NethServer/ns8-metrics#99). Grafana now runs fromghcr.io/nethserver/metrics-grafana, which bundles Logs Drilldown and Metrics Drilldown, and never downloads plugins.Setup:
metrics1on 1.5.x with Grafana enabled (grafana_pathset) and internet access, so Grafana has already downloaded its plugins:runagent -m metrics1 podman exec grafana ls /var/lib/grafana/pluginsExpected: a list of plugins (17 on a fresh 1.5.1), e.g.
grafana-lokiexplore-app,loki,prometheus.Steps
ghcr.io/nethserver/metrics-grafana:1.6.0-dev.2; onlyMETRICS_GRAFANA_IMAGEset (on core 3.23.0 a harmlessPREV_METRICS_GRAFANA_IMAGE=Noneis also present, fixed by fix(update-module): skip missing previous images ns8-core#1358); nodocker.io/grafana/grafanaorquay.ioimages left.grafana.com:0.DavidePrincipi commentedon Oct 15, 2026
Test results: metrics 1.6.0-dev.1
Test node: fresh NS8 (core 3.23.0) on Rocky Linux 9, new cluster.
metrics1andloki11.5.1 installed bycreate-cluster; Grafana enabled at/grafana, which downloaded 17 plugins within 40 seconds.update-module ghcr.io/nethserver/metrics:1.6.0-dev.1 metrics1ghcr.io/nethserver/metrics-grafana:1.6.0-dev.1METRICS_GRAFANA_IMAGEset;PREV_METRICS_GRAFANA_IMAGE=Nonealso present (core issue, see below)metrics-grafana,metrics,docker.io/prom/prometheus,docker.io/prom/alertmanager;quay.io/*anddocker.io/grafana/grafanaremovedbackgroundinstaller/grafana.comin the Grafana logpluginAdminEnabled=false, install API returns 404Step 4 was checked through the Grafana API, not in a browser.
The⚠️ comes from the core: when an update adds a new image,
update-modulestoresPREV_<NAME>_IMAGE=Noneand its cleanup step runspodman image rm None, which fails without affecting the update. Fixed by NethServer/ns8-core#1358.DavidePrincipi commentedon Oct 15, 2026
Test results: metrics 1.6.0-dev.2
Same test node, updated from 1.6.0-dev.1 with
update-module ghcr.io/nethserver/metrics:1.6.0-dev.2 metrics1. The new release bumps Prometheus to 3.13.4 and Alertmanager from 0.32.1 to 0.34.1.prom/prometheus:v3.13.4,prom/alertmanager:v0.34.1,metrics-grafana:1.6.0-dev.2; the previous ones were removed by the coreAlertmanager release notes 0.33–0.34 have no changes affecting the module: the removed
auto-gomaxprocsflag and the renamedreasonvalues ofalertmanager_notifications_failed_totalare not used, and 0.34.1 fixes inhibition bugs. Mail notifications were not tested (no mail relay on the test cluster).DavidePrincipi commentedon Oct 15, 2026
Released