Wrong format..

This commit is contained in:
Root User 2026-02-14 17:09:50 +01:00
parent a519b8ffec
commit 99c43c145e
Signed by: root
GPG key ID: 087F0A95E5766D72

View file

@ -177,51 +177,42 @@ in {
environment.etc."alloy/config.alloy" = {
text = ''
server:
http_listen_port: 28183
grpc_listen_port: 0
loki.relabel "journal" {
rule {
source_labels = ["__journal__systemd_unit"]
target_label = "unit"
}
}
logs:
# keep positions persistent on disk (don't use /tmp in production)
positions:
filename: /var/lib/grafana-agent/positions.yaml
loki.write "local" {
endpoint {
url = "http://127.0.0.1:3100/loki/api/v1/push"
}
external_labels = {}
}
configs:
- name: journal
journal:
# keep similar rotation / lookback to your promtail config
max_age: 12h
labels:
job: systemd-journal
host: chrysalis
loki.source.journal "journal" {
max_age = "12h0m0s"
clients:
- url: http://127.0.0.1:3100/loki/api/v1/push
forward_to = [loki.write.local.receiver]
relabel_configs:
- source_labels: ["__journal__systemd_unit"]
target_label: "unit"
labels = {
job = "systemd-journal"
host = "chrysalis"
}
relabel_rules = loki.relabel.journal.rules
legacy_position {
file = "/var/lib/grafana-agent/positions.yaml"
name = "journal"
}
}
'';
group = "root";
mode = "0644";
};
# Add a simple systemd service to run the Grafana Agent (Alloy)
systemd.services.grafana-agent = {
description = "Grafana Alloy";
wantedBy = ["multi-user.target"];
serviceConfig = {
# The grafana-agent binary provided by nixpkgs
ExecStart = ''
${pkgs.grafana-alloy}/bin/alloy run
'';
Restart = "on-failure";
RestartSec = "5s";
};
};
# or alternatively
#configFile = ./loki-config.yaml;
# };