43 lines
869 B
Nix
43 lines
869 B
Nix
{ config, constants, ... }:
|
|
|
|
{
|
|
services.promtail = {
|
|
enable = true;
|
|
configuration = {
|
|
server = {
|
|
http_listen_port = 9080;
|
|
grpc_listen_port = 0;
|
|
};
|
|
|
|
clients = [
|
|
{
|
|
url = "http://${constants.hosts.sid.ip}:3100/loki/api/v1/push";
|
|
}
|
|
];
|
|
|
|
scrape_configs = [
|
|
{
|
|
job_name = "journal";
|
|
journal = {
|
|
max_age = "12h";
|
|
path = "/var/log/journal";
|
|
|
|
labels = {
|
|
job = "systemd-journal";
|
|
host = config.networking.hostName;
|
|
};
|
|
};
|
|
|
|
relabel_configs = [
|
|
{
|
|
source_labels = [ "__journal__systemd_unit" ];
|
|
target_label = "unit";
|
|
}
|
|
];
|
|
}
|
|
];
|
|
};
|
|
};
|
|
|
|
users.users.promtail.extraGroups = [ "systemd-journal" ];
|
|
}
|