74 lines
1.7 KiB
Nix
74 lines
1.7 KiB
Nix
|
{ 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"
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
};
|
||
|
};
|
||
|
}
|