nixos-servers/system/monitoring/logs.nix

56 lines
1.2 KiB
Nix
Raw Normal View History

2025-01-27 23:49:22 +00:00
{ config, ... }:
2024-12-01 02:00:07 +00:00
{
services.promtail = {
enable = true;
configuration = {
server = {
http_listen_address = "0.0.0.0";
http_listen_port = 9099;
2024-12-01 19:51:14 +00:00
grpc_listen_address = "0.0.0.0";
grpc_listen_port = 9098;
2024-12-01 02:00:07 +00:00
};
clients = [
{
url = "http://monitoring01.home.2rjus.net:3100/loki/api/v1/push";
}
];
scrape_configs = [
{
job_name = "journal";
journal = {
json = true;
labels = {
job = "systemd-journal";
};
2024-12-01 02:00:07 +00:00
};
relabel_configs = [
{
source_labels = [ "__journal__systemd_unit" ];
target_label = "systemd_unit";
}
{
source_labels = [ "__journal__hostname" ];
target_label = "host";
}
];
}
2025-01-27 23:49:22 +00:00
{
job_name = "varlog";
static_configs = [
{
targets = [ "localhost" ];
labels = {
job = "varlog";
__path__ = "/var/log/**/*.log";
hostname = "${config.networking.hostName}";
};
}
];
}
2024-12-01 02:00:07 +00:00
];
};
};
}