all: setup promtail

This commit is contained in:
Adithya 2024-07-21 19:10:11 +05:30
parent 0ca7ce294b
commit 2f90fe0952
Signed by: adtya
GPG key ID: B8857BFBA2C47B9C
6 changed files with 51 additions and 0 deletions

View file

@ -2,5 +2,6 @@ _: {
imports = [
./transmission.nix
../../../shared/prometheus-exporters.nix
../../../shared/promtail.nix
];
}

View file

@ -5,5 +5,6 @@ _: {
./loki.nix
./prometheus.nix
../../../shared/prometheus-exporters.nix
../../../shared/promtail.nix
];
}

View file

@ -4,5 +4,6 @@ _: {
./proofs.nix
./wiki.nix
../../../shared/prometheus-exporters.nix
../../../shared/promtail.nix
];
}

View file

@ -1,5 +1,6 @@
_: {
imports = [
../../../shared/prometheus-exporters.nix
../../../shared/promtail.nix
];
}

46
hosts/shared/promtail.nix Normal file
View file

@ -0,0 +1,46 @@
{ config, ... }: {
services = {
caddy = {
virtualHosts."promtail.${config.networking.hostName}.labs.adtya.xyz" = {
extraConfig = ''
reverse_proxy 127.0.0.1:9080
tls /persist/secrets/caddy/certs/default.crt /persist/secrets/caddy/certs/default.key
'';
};
};
promtail = {
enable = true;
configuration = {
server = {
http_listen_address = "127.0.0.1";
http_listen_port = 9080;
};
clients = [
{
url = "https://loki.labs.adtya.xyz/api/v1/push";
tenant_id = 1;
}
];
positions = { filename = "/tmp/promtail-positions.yaml"; };
scrape_configs = [
{
job_name = "journal";
journal = {
json = false;
max_age = "12h";
path = "/var/log/journal";
matches = "_TRANSPORT=kernel";
labels = { job = "systemd-journal"; host = "${config.networking.hostName}"; };
};
relabel_config = [
{
source_labels = [ "__journal__systemd_unit" ];
target_label = "unit";
}
];
}
];
};
};
};
}

View file

@ -4,5 +4,6 @@ _: {
./acomputer.lol.nix
./postgresql.nix
../../../shared/prometheus-exporters.nix
../../../shared/promtail.nix
];
}