sid.ovh/modules/nixos/loki/default.nix
sid f2ebf66262
All checks were successful
Build hosts / build-hosts (pull_request) Successful in 21s
Flake check / flake-check (pull_request) Successful in 22s
loki: add apiVersion
2026-05-22 20:09:24 +02:00

115 lines
2.5 KiB
Nix

{
services.loki = {
enable = true;
configuration = {
auth_enabled = false;
server = {
http_listen_address = "0.0.0.0";
http_listen_port = 3100;
grpc_listen_port = 9096;
};
common = {
ring = {
instance_addr = "127.0.0.1";
kvstore.store = "inmemory";
};
replication_factor = 1;
path_prefix = "/var/lib/loki";
};
ingester = {
wal = {
enabled = true;
dir = "/var/lib/loki/wal";
};
chunk_encoding = "snappy";
chunk_idle_period = "30m";
max_chunk_age = "2h";
chunk_target_size = 1572864;
chunk_block_size = 262144;
};
limits_config = {
reject_old_samples = true;
reject_old_samples_max_age = "168h";
ingestion_rate_mb = 10;
ingestion_burst_size_mb = 20;
per_stream_rate_limit = "3MB";
per_stream_rate_limit_burst = "15MB";
max_line_size = "256KB";
};
schema_config = {
configs = [
{
from = "2026-01-01";
store = "tsdb";
object_store = "filesystem";
schema = "v13";
index = {
prefix = "index_";
period = "24h";
};
}
];
};
storage_config = {
filesystem = {
directory = "/var/lib/loki/chunks";
};
};
compactor = {
working_directory = "/var/lib/loki/compactor";
compaction_interval = "10m";
retention_enabled = true;
retention_delete_delay = "2h";
retention_delete_worker_count = 150;
delete_request_store = "filesystem";
};
};
};
services.grafana = {
enable = true;
settings = {
server = {
http_addr = "0.0.0.0";
http_port = 3003;
};
"auth.anonymous" = {
enabled = true;
org_name = "Main Org.";
org_role = "Admin";
};
};
provision = {
enable = true;
datasources.settings = {
apiVersion = 1;
datasources = [
{
name = "Loki";
type = "loki";
access = "proxy";
url = "http://127.0.0.1:3100";
isDefault = true;
uid = "loki";
}
];
};
dashboards.settings.providers = [
{
name = "default";
options.path = ./dashboards;
}
];
};
};
networking.firewall.allowedTCPPorts = [ 3100 ];
}