grafana: forward the host env to the logs datasource plugin
This commit is contained in:
parent
8e09f8360a
commit
a9d181b53f
2 changed files with 24 additions and 0 deletions
|
|
@ -1340,6 +1340,14 @@ in
|
||||||
# from anything that mentions Grafana.
|
# from anything that mentions Grafana.
|
||||||
metrics.enabled = true;
|
metrics.enabled = true;
|
||||||
|
|
||||||
|
# Grafana hands an external backend plugin only an allow-list of
|
||||||
|
# its environment (the proxy variables), so without this the logs
|
||||||
|
# datasource never sees the unit's `SSL_CERT_FILE` and rejects the
|
||||||
|
# log store's certificate as `x509: unknown authority`. The value
|
||||||
|
# is plugin ids, not variable names: each listed plugin gets the
|
||||||
|
# whole environment.
|
||||||
|
plugins.forward_host_env_vars = "victoriametrics-logs-datasource";
|
||||||
|
|
||||||
users.auto_assign_org_role = cfg.oidc.role;
|
users.auto_assign_org_role = cfg.oidc.role;
|
||||||
|
|
||||||
# ⚠️ `$__file{}`, and required rather than optional: nixpkgs
|
# ⚠️ `$__file{}`, and required rather than optional: nixpkgs
|
||||||
|
|
|
||||||
|
|
@ -426,6 +426,22 @@ let
|
||||||
&& logs.jsonData.httpHeaderName1 == "Authorization"
|
&& logs.jsonData.httpHeaderName1 == "Authorization"
|
||||||
&& logs.secureJsonData.httpHeaderValue1 == metrics.secureJsonData.httpHeaderValue1;
|
&& logs.secureJsonData.httpHeaderValue1 == metrics.secureJsonData.httpHeaderValue1;
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
# An external plugin inherits only Grafana's proxy variables unless its
|
||||||
|
# id is listed here, and without `SSL_CERT_FILE` every logs query fails
|
||||||
|
# `x509: unknown authority`. Compared against the provisioned
|
||||||
|
# datasource's `type`, so renaming one side without the other fails.
|
||||||
|
name = "the logs datasource's plugin is handed Grafana's environment";
|
||||||
|
ok =
|
||||||
|
let
|
||||||
|
grafana = grafanaWithAuthelia.containers.swarm-grafana.config.services.grafana;
|
||||||
|
logs = lib.findFirst (
|
||||||
|
d: d.uid == "swarm-victorialogs"
|
||||||
|
) null grafana.provision.datasources.settings.datasources;
|
||||||
|
in
|
||||||
|
logs != null
|
||||||
|
&& lib.elem logs.type (lib.toList (grafana.settings.plugins.forward_host_env_vars or [ ]));
|
||||||
|
}
|
||||||
{
|
{
|
||||||
# The reader's half of the same mapping. The collector writes a severity
|
# The reader's half of the same mapping. The collector writes a severity
|
||||||
# TEXT; nothing downstream reads it as a level unless the datasource is
|
# TEXT; nothing downstream reads it as a level unless the datasource is
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue