cluster/services/monitoring: use grafana-agent for central logging
This commit is contained in:
parent
102c3c0373
commit
1945265362
1 changed files with 8 additions and 12 deletions
|
@ -1,9 +1,7 @@
|
||||||
{ cluster, config, lib, pkgs, ... }:
|
{ cluster, config, lib, ... }:
|
||||||
let
|
let
|
||||||
myNode = cluster.config.vars.mesh.${cluster.config.vars.hostName};
|
myNode = cluster.config.vars.mesh.${cluster.config.vars.hostName};
|
||||||
|
|
||||||
writeJSON = filename: data: pkgs.writeText filename (builtins.toJSON data);
|
|
||||||
|
|
||||||
relabel = from: to: {
|
relabel = from: to: {
|
||||||
source_labels = [ from ];
|
source_labels = [ from ];
|
||||||
target_label = to;
|
target_label = to;
|
||||||
|
@ -38,13 +36,12 @@ in {
|
||||||
serviceConfig.RestartSec = "10s";
|
serviceConfig.RestartSec = "10s";
|
||||||
};
|
};
|
||||||
|
|
||||||
systemd.services.promtail = {
|
services.grafana-agent = {
|
||||||
wantedBy = [ "multi-user.target" ];
|
enable = true;
|
||||||
|
settings = {
|
||||||
serviceConfig = {
|
logs.configs = lib.singleton {
|
||||||
ExecStart = "${pkgs.grafana-loki}/bin/promtail --config.expand-env=true --config.file ${writeJSON "promtail.yaml" {
|
name = "logging";
|
||||||
server.disable = true;
|
positions.filename = "\${STATE_DIRECTORY:/tmp}/logging-positions.yaml";
|
||||||
positions.filename = "\${STATE_DIRECTORY:/tmp}/promtail-positions.yaml";
|
|
||||||
clients = [
|
clients = [
|
||||||
{ url = "${cluster.config.links.loki-ingest.url}/loki/api/v1/push"; }
|
{ url = "${cluster.config.links.loki-ingest.url}/loki/api/v1/push"; }
|
||||||
];
|
];
|
||||||
|
@ -66,8 +63,7 @@ in {
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}}";
|
};
|
||||||
StateDirectory = "promtail";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue