52 lines
No EOL
1.2 KiB
Nix
52 lines
No EOL
1.2 KiB
Nix
{ config, pkgs, ... }: {
|
|
# Promtail Logging
|
|
|
|
# Import the file:
|
|
sops.defaultSopsFile = ./secrets/secrets.yaml;
|
|
|
|
# Define the secrets
|
|
sops.secrets.promtail.user = {};
|
|
sops.secrets.promtail.pass = {};
|
|
sops.secrets.promtail.url = {};
|
|
|
|
# Install the package
|
|
environment.systemPackages = with pkgs; [
|
|
promtail
|
|
];
|
|
|
|
# Configure the package:
|
|
# https://mynixos.com/nixpkgs/option/services.promtail.configuration
|
|
services.promtail = {
|
|
enable = true;
|
|
configuration = {
|
|
server = {
|
|
http_listen_port = 3031;
|
|
grpc_listen_port = 0;
|
|
};
|
|
positions = {
|
|
filename = "/tmp/positions.yaml";
|
|
};
|
|
clients = [{
|
|
url = "https://loki.sysctl.io/loki/api/v1/push";
|
|
basic_auth = {
|
|
username = "loki-sa";
|
|
password = null; # https://nixos.wiki/wiki/Comparison_of_secret_managing_schemes;
|
|
};
|
|
}];
|
|
scrape_configs = [{
|
|
job_name = "journal";
|
|
journal = {
|
|
max_age = "12h";
|
|
labels = {
|
|
job = "systemd-journal";
|
|
host = "nixos-p1";
|
|
};
|
|
};
|
|
relabel_configs = [{
|
|
source_labels = [ "__journal__systemd_unit" ];
|
|
target_label = "unit";
|
|
}];
|
|
}];
|
|
};
|
|
};
|
|
} |