Wrong format..
This commit is contained in:
parent
a519b8ffec
commit
99c43c145e
1 changed files with 27 additions and 36 deletions
|
|
@ -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;
|
||||||
# };
|
# };
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue