all: setup promtail
This commit is contained in:
parent
0ca7ce294b
commit
2f90fe0952
6 changed files with 51 additions and 0 deletions
|
@ -2,5 +2,6 @@ _: {
|
|||
imports = [
|
||||
./transmission.nix
|
||||
../../../shared/prometheus-exporters.nix
|
||||
../../../shared/promtail.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -5,5 +5,6 @@ _: {
|
|||
./loki.nix
|
||||
./prometheus.nix
|
||||
../../../shared/prometheus-exporters.nix
|
||||
../../../shared/promtail.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -4,5 +4,6 @@ _: {
|
|||
./proofs.nix
|
||||
./wiki.nix
|
||||
../../../shared/prometheus-exporters.nix
|
||||
../../../shared/promtail.nix
|
||||
];
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
_: {
|
||||
imports = [
|
||||
../../../shared/prometheus-exporters.nix
|
||||
../../../shared/promtail.nix
|
||||
];
|
||||
}
|
||||
|
|
46
hosts/shared/promtail.nix
Normal file
46
hosts/shared/promtail.nix
Normal 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";
|
||||
}
|
||||
];
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -4,5 +4,6 @@ _: {
|
|||
./acomputer.lol.nix
|
||||
./postgresql.nix
|
||||
../../../shared/prometheus-exporters.nix
|
||||
../../../shared/promtail.nix
|
||||
];
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue