Configured more machines to push logs to loki

This commit is contained in:
Alejandro Angulo 2023-09-10 10:08:17 -07:00
parent 8f813f3865
commit ab218cd1a2
Signed by: alejandro-angulo
GPG key ID: 75579581C74554B6
5 changed files with 11 additions and 54 deletions

View file

@ -11,14 +11,6 @@ with lib; let
in { in {
options.aa.services.loki = with types; { options.aa.services.loki = with types; {
enable = mkEnableOption "loki"; enable = mkEnableOption "loki";
acmeCertName = mkOption {
type = str;
default = "";
description = ''
If set to a non-empty string, forces SSL with the supplied acme
certificate.
'';
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -103,20 +95,8 @@ in {
}; };
}; };
services.nginx = mkIf (cfg.acmeCertName != "") {
enable = true;
# Confirm with /loki/api/v1/status/buildinfo
virtualHosts."loki.${cfg.acmeCertName}" = {
locations."/" = {
proxyPass = "http://localhost:${toString loki.configuration.server.http_listen_port}";
};
forceSSL = true;
useACMEHost = cfg.acmeCertName;
};
};
networking.firewall = { networking.firewall = {
allowedTCPPorts = [80 443]; allowedTCPPorts = [loki.configuration.server.http_listen_port];
}; };
}; };
} }

View file

@ -11,14 +11,6 @@ with lib; let
in { in {
options.aa.services.promtail = with types; { options.aa.services.promtail = with types; {
enable = mkEnableOption "promtail"; enable = mkEnableOption "promtail";
acmeCertName = mkOption {
type = str;
default = "";
description = ''
If set to a non-empty string, forces SSL with the supplied acme
certificate.
'';
};
}; };
config = mkIf cfg.enable { config = mkIf cfg.enable {
@ -34,7 +26,8 @@ in {
}; };
clients = [ clients = [
{ {
url = "http://127.0.0.1:${toString loki.configuration.server.http_listen_port}/loki/api/v1/push"; # TODO: Don't hardcode this?
url = "http://node:3030/loki/api/v1/push";
} }
]; ];
scrape_configs = [ scrape_configs = [
@ -44,7 +37,7 @@ in {
max_age = "12h"; max_age = "12h";
labels = { labels = {
job = "systemd-journal"; job = "systemd-journal";
host = "node"; host = config.networking.hostName;
}; };
}; };
relabel_configs = [ relabel_configs = [
@ -58,20 +51,8 @@ in {
}; };
}; };
services.nginx = mkIf (cfg.acmeCertName != "") { # networking.firewall = {
enable = true; # allowedTCPPorts = [80 443];
# Confirm with /loki/api/v1/status/buildinfo # };
virtualHosts."promtail.${cfg.acmeCertName}" = {
locations."/" = {
proxyPass = "http://localhost:${toString config.services.promtail.configuration.server.http_listen_port}";
};
forceSSL = true;
useACMEHost = cfg.acmeCertName;
};
};
networking.firewall = {
allowedTCPPorts = [80 443];
};
}; };
} }

View file

@ -42,6 +42,7 @@
acmeCertName = "kilonull.com"; acmeCertName = "kilonull.com";
}; };
services.prometheus.enable = true; services.prometheus.enable = true;
services.promtail.enable = true;
security.acme = { security.acme = {
enable = true; enable = true;

View file

@ -57,6 +57,7 @@
}; };
}; };
services.prometheus.enable = true; services.prometheus.enable = true;
services.promtail.enable = true;
hardware.audio.enable = true; hardware.audio.enable = true;
hardware.bluetooth.enable = true; hardware.bluetooth.enable = true;

View file

@ -38,14 +38,8 @@
enable = true; enable = true;
enableServer = true; enableServer = true;
}; };
services.loki = { services.loki.enable = true;
enable = true; services.promtail.enable = true;
acmeCertName = "kilonull.com";
};
services.promtail = {
enable = true;
acmeCertName = "kilonull.com";
};
services.syncoid = { services.syncoid = {
# sudo -u backups zfs create -o mountpoint=/tank/backups/gospel tank/backups/gospel # sudo -u backups zfs create -o mountpoint=/tank/backups/gospel tank/backups/gospel
enable = true; enable = true;