nix/laptop/promtail.nix

74 lines
1.7 KiB
Nix
Raw Normal View History

2023-06-30 04:39:01 +02:00
{ config, pkgs, ... }: {
# Promtail Logging
# Install the package
environment.systemPackages = with pkgs; [
promtail
];
# Configure the package:
# https://mynixos.com/nixpkgs/option/services.promtail.configuration
services.promtail = {
enable = true;
configuration = {
{
"positions": {
"filename": "/tmp/positions.yaml"
},
"clients": [
{
"url": "https://loki.sysctl.io/loki/api/v1/push",
"basic_auth": {
"username": "loki-sa",
"password": https://nixos.wiki/wiki/Comparison_of_secret_managing_schemes
}
}
],
"scrape_configs": [
{
"job_name": "system",
"static_configs": [
{
"targets": [
"localhost"
],
"labels": {
"job": "varlogs",
"__path__": "/host/var/log/*.log"
}
}
],
"pipeline_stages": [
{
"static_labels": {
"host": "nixos-p1"
}
}
]
},
{
"job_name": "secure",
"static_configs": [
{
"targets": [
"localhost"
],
"labels": {
"job": "varlogs",
"__path__": "/host/var/log/secure"
}
}
],
"pipeline_stages": [
{
"static_labels": {
"host": "nixos-p1"
}
}
]
}
]
}
};
};
}