2022-12-19 22:56:42 +01:00
|
|
|
{ config, pkgs, ... }:
|
|
|
|
|
2022-12-20 21:44:22 +01:00
|
|
|
let
|
|
|
|
cfg = config.services.loki;
|
|
|
|
in {
|
2022-12-19 22:56:42 +01:00
|
|
|
services.loki = {
|
|
|
|
enable = true;
|
|
|
|
configuration = {
|
|
|
|
auth_enabled = false;
|
|
|
|
server = {
|
|
|
|
http_listen_port = 3100;
|
2022-12-20 15:58:12 +01:00
|
|
|
http_listen_address = "0.0.0.0";
|
2022-12-19 22:56:42 +01:00
|
|
|
grpc_listen_port = 9096;
|
|
|
|
};
|
|
|
|
|
|
|
|
ingester = {
|
|
|
|
wal = {
|
|
|
|
enabled = true;
|
|
|
|
dir = "/var/lib/loki/wal";
|
|
|
|
};
|
|
|
|
lifecycler = {
|
2022-12-20 13:08:26 +01:00
|
|
|
address = "127.0.0.1";
|
2022-12-19 22:56:42 +01:00
|
|
|
ring = {
|
|
|
|
kvstore = {
|
|
|
|
store = "inmemory";
|
|
|
|
};
|
|
|
|
replication_factor = 1;
|
|
|
|
};
|
|
|
|
final_sleep = "0s";
|
|
|
|
};
|
2022-12-20 13:08:26 +01:00
|
|
|
chunk_idle_period = "1h";
|
2022-12-19 22:56:42 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
schema_config = {
|
|
|
|
configs = [
|
|
|
|
{
|
2022-12-20 13:08:26 +01:00
|
|
|
from = "2022-12-01";
|
|
|
|
store = "boltdb-shipper";
|
2022-12-19 22:56:42 +01:00
|
|
|
object_store = "filesystem";
|
|
|
|
schema = "v11";
|
|
|
|
index = {
|
|
|
|
prefix = "index_";
|
2022-12-20 13:08:26 +01:00
|
|
|
period = "24h";
|
2022-12-19 22:56:42 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
];
|
|
|
|
};
|
|
|
|
|
|
|
|
storage_config = {
|
|
|
|
boltdb_shipper = {
|
2022-12-20 13:08:26 +01:00
|
|
|
active_index_directory = "/var/lib/loki/boltdb-shipper-index";
|
|
|
|
cache_location = "/var/lib/loki/boltdb-shipper-cache";
|
2022-12-19 22:56:42 +01:00
|
|
|
cache_ttl = "24h";
|
|
|
|
};
|
|
|
|
filesystem = {
|
|
|
|
directory = "/var/lib/loki/chunks";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
limits_config = {
|
2024-06-29 20:45:54 +02:00
|
|
|
allow_structured_metadata = false;
|
2022-12-19 22:56:42 +01:00
|
|
|
reject_old_samples = true;
|
|
|
|
reject_old_samples_max_age = "72h";
|
|
|
|
};
|
|
|
|
|
|
|
|
compactor = {
|
|
|
|
working_directory = "/var/lib/loki/compactor";
|
|
|
|
};
|
|
|
|
|
|
|
|
# ruler = {
|
|
|
|
# storage = {
|
|
|
|
# type = "local";
|
|
|
|
# local = {
|
|
|
|
# directory = "/var/lib/loki/rules";
|
|
|
|
# };
|
|
|
|
# };
|
|
|
|
# rule_path = "/etc/loki/rules";
|
|
|
|
# alertmanager_url = "http://localhost:9093";
|
|
|
|
# };
|
|
|
|
};
|
|
|
|
};
|
2022-12-20 13:08:26 +01:00
|
|
|
|
2022-12-20 21:44:22 +01:00
|
|
|
networking.firewall.allowedTCPPorts = [ cfg.configuration.server.http_listen_port ];
|
2022-12-19 22:56:42 +01:00
|
|
|
}
|