nixos-config/hosts/defiant/services/monitoring/loki.nix

77 lines
1.7 KiB
Nix
Raw Normal View History

2023-04-15 20:44:47 +02:00
{ config, pkgs, ... }:
let
cfg = config.services.loki;
saveDirectory = "/tank/services/metrics/loki";
2023-04-15 20:44:47 +02:00
in {
services.loki = {
enable = true;
dataDir = saveDirectory;
2023-04-15 20:44:47 +02:00
configuration = {
auth_enabled = false;
server = {
http_listen_port = 3100;
http_listen_address = "0.0.0.0";
grpc_listen_port = 9096;
};
ingester = {
wal = {
enabled = true;
2023-04-19 10:48:16 +02:00
dir = "${saveDirectory}/wal";
2023-04-15 20:44:47 +02:00
};
lifecycler = {
address = "127.0.0.1";
ring = {
kvstore = {
store = "inmemory";
};
replication_factor = 1;
};
final_sleep = "0s";
};
chunk_idle_period = "1h";
};
schema_config = {
configs = [
{
from = "2022-12-01";
store = "boltdb-shipper";
object_store = "filesystem";
schema = "v11";
index = {
prefix = "index_";
period = "24h";
};
}
];
};
storage_config = {
boltdb_shipper = {
2023-04-19 10:48:16 +02:00
active_index_directory = "${saveDirectory}/boltdb-shipper-index";
cache_location = "${saveDirectory}/boltdb-shipper-cache";
2023-04-15 20:44:47 +02:00
cache_ttl = "24h";
};
filesystem = {
2023-04-19 10:48:16 +02:00
directory = "${saveDirectory}/chunks";
2023-04-15 20:44:47 +02:00
};
};
limits_config = {
2024-06-02 01:57:03 +02:00
allow_structured_metadata = false;
2023-04-15 20:44:47 +02:00
reject_old_samples = true;
reject_old_samples_max_age = "72h";
};
compactor = {
2023-04-19 10:48:16 +02:00
working_directory = "${saveDirectory}/compactor";
2023-04-15 20:44:47 +02:00
};
};
};
networking.firewall.allowedTCPPorts = [
cfg.configuration.server.http_listen_port
];
2023-04-15 20:44:47 +02:00
}