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" = { environment.etc."alloy/config.alloy" = {
text = '' text = ''
server: loki.relabel "journal" {
http_listen_port: 28183 rule {
grpc_listen_port: 0 source_labels = ["__journal__systemd_unit"]
target_label = "unit"
}
}
logs: loki.write "local" {
# keep positions persistent on disk (don't use /tmp in production) endpoint {
positions: url = "http://127.0.0.1:3100/loki/api/v1/push"
filename: /var/lib/grafana-agent/positions.yaml }
external_labels = {}
}
configs: loki.source.journal "journal" {
- name: journal max_age = "12h0m0s"
journal:
# keep similar rotation / lookback to your promtail config
max_age: 12h
labels:
job: systemd-journal
host: chrysalis
clients: forward_to = [loki.write.local.receiver]
- url: http://127.0.0.1:3100/loki/api/v1/push
relabel_configs: labels = {
- source_labels: ["__journal__systemd_unit"] job = "systemd-journal"
target_label: "unit" host = "chrysalis"
}
relabel_rules = loki.relabel.journal.rules
legacy_position {
file = "/var/lib/grafana-agent/positions.yaml"
name = "journal"
}
}
''; '';
group = "root"; group = "root";
mode = "0644"; 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 # or alternatively
#configFile = ./loki-config.yaml; #configFile = ./loki-config.yaml;
# }; # };