generated from john/nix-docker
86 lines
2.2 KiB
Nix
86 lines
2.2 KiB
Nix
{ pkgs, config, ... }:
|
|
{
|
|
networking.firewall.allowedTCPPorts = [
|
|
config.services.loki.configuration.server.http_listen_port
|
|
];
|
|
|
|
environment.systemPackages = with pkgs; [
|
|
(pkgs.writeShellScriptBin "loki-check" ''
|
|
curl http://localhost:${config.services.loki.configuration.server.http_listen_port}/ready
|
|
'')
|
|
(pkgs.writeShellScriptBin "loki-logs" "journalctl -b -u loki.service -n 10")
|
|
];
|
|
|
|
services.loki = {
|
|
enable = true;
|
|
user = "loki";
|
|
|
|
configuration = {
|
|
server.http_listen_port = 3100;
|
|
# server.grpc_listen_port = 9096;
|
|
auth_enabled = false;
|
|
|
|
ingester = {
|
|
lifecycler = {
|
|
address = "0.0.0.0";
|
|
ring = {
|
|
kvstore = {
|
|
store = "inmemory";
|
|
};
|
|
replication_factor = 1;
|
|
};
|
|
};
|
|
chunk_idle_period = "1h";
|
|
max_chunk_age = "1h";
|
|
chunk_target_size = 1048576;
|
|
chunk_retain_period = "30s";
|
|
};
|
|
|
|
schema_config = {
|
|
configs = [{
|
|
from = "2024-04-01";
|
|
object_store = "filesystem";
|
|
store = "tsdb";
|
|
schema = "v13";
|
|
index = {
|
|
prefix = "index_";
|
|
period = "24h";
|
|
};
|
|
}];
|
|
};
|
|
|
|
storage_config = {
|
|
tsdb_shipper = {
|
|
active_index_directory = "/var/lib/loki/index";
|
|
cache_location = "/var/lib/loki/index_cache";
|
|
};
|
|
filesystem = {
|
|
directory = "/var/lib/loki/chunks";
|
|
};
|
|
};
|
|
|
|
compactor = {
|
|
retention_enabled = true;
|
|
compaction_interval = "10m";
|
|
working_directory = "/tmp/loki";
|
|
retention_delete_delay = "2h";
|
|
retention_delete_worker_count = 150;
|
|
delete_request_store = "filesystem";
|
|
};
|
|
|
|
limits_config = {
|
|
retention_period = "744h";
|
|
reject_old_samples = true;
|
|
reject_old_samples_max_age = "168h";
|
|
split_queries_by_interval = "24h";
|
|
ingestion_rate_mb = 10;
|
|
ingestion_burst_size_mb = 200;
|
|
allow_structured_metadata = true;
|
|
};
|
|
|
|
query_scheduler.max_outstanding_requests_per_tenant = 4096;
|
|
frontend.max_outstanding_per_tenant = 4096;
|
|
query_range.parallelise_shardable_queries = true;
|
|
};
|
|
};
|
|
} |