Newer
Older
# Scope: Log ingester and aggregator to be run on the monitoring node
#
# See also:
# - The configuration is adapted from
# https://grafana.com/docs/loki/latest/configuration/examples/#complete-local-configyaml
#
{ config, ...}:
let
logRetention = toString(config.services.private-storage.monitoring.policy.logRetentionSeconds) + "s";
in {
config.networking.firewall.interfaces.monitoringvpn.allowedTCPPorts = [ 3100 ];
config.services.loki = {
enable = true;
configuration =
{
auth_enabled = false;
server = {
http_listen_port = 3100;
grpc_listen_port = 9095; # unused, but no option to turn it off.
grpc_listen_address = "127.0.0.1"; # unused, but no option to turn it off.
};
ingester = {
lifecycler = {
ring = {
kvstore = {
store = "inmemory";
};
replication_factor = 1;
};
chunk_target_size = 1536000; # As per https://grafana.com/docs/loki/v2.2.1/best-practices/
max_transfer_retries = 0; # Chunk transfers disabled
};
schema_config = {
configs = [{
from = "2020-12-26";
store = "boltdb";
object_store = "filesystem";
schema = "v11";
index = {
prefix = "index_";
};
}];
};
storage_config = {
boltdb = {
directory = "/var/lib/loki/index";
filesystem = {
directory = "/var/lib/loki/chunks";
};
};
table_manager = {
retention_deletes_enabled = true;
retention_period = logRetention;
};
};
};
}