alpine: loki fixes

This commit is contained in:
Tristan 2025-08-04 21:39:05 +01:00
parent 76306f2caf
commit b5f1220ea9
4 changed files with 71 additions and 62 deletions

View file

@ -10,7 +10,7 @@
}; };
authentik-config = { authentik-config = {
autoStart = true; autoStart = true;
image = "ghcr.io/goauthentik/server:2025.6.0"; image = "ghcr.io/goauthentik/server:2025.6.3";
volumes = ["/home/tristan/pods/authentik/media:/media"]; volumes = ["/home/tristan/pods/authentik/media:/media"];
environment = { environment = {
AUTHENTIK_POSTGRESQL__USER = postgres.user; AUTHENTIK_POSTGRESQL__USER = postgres.user;

View file

@ -48,7 +48,7 @@ in {
{ {
name = "synapse"; name = "synapse";
url = "https://raw.githubusercontent.com/element-hq/synapse/refs/heads/master/contrib/grafana/synapse.json"; url = "https://raw.githubusercontent.com/element-hq/synapse/refs/heads/master/contrib/grafana/synapse.json";
sha256 = "sha256:07qlr0waw9phmyd38bv22bn5v303w3397b89l44l3lzwhpnhs16s"; sha256 = "sha256:16fl81sx1by0wldw4vda0zr1pvbq1dpih1fikzwlvmk63mpc80kb";
} }
]; ];
}]; }];

View file

@ -21,78 +21,74 @@ in {
storage_config."filesystem".directory = "/tmp/loki/chunks"; storage_config."filesystem".directory = "/tmp/loki/chunks";
common = { common = {
ring = { ring = {
instance_addr = "127.0.0.1";
kvstore.store = "inmemory"; kvstore.store = "inmemory";
}; };
replication_factor = 1; replication_factor = 1;
path_prefix = "/tmp/loki"; path_prefix = "/tmp/loki";
}; };
# https://grafana.com/docs/loki/latest/configure/#limits_config
limits_config = { limits_config = {
ingestion_rate_strategy = "local"; ingestion_rate_strategy = "local";
ingestion_rate_mb = 24; ingestion_rate_mb = 128;
ingestion_burst_size_mb = 36; ingestion_burst_size_mb = 256;
max_streams_per_user = 0;
max_global_streams_per_user = 0;
}; };
}; };
}; };
services.prometheus.scrapeConfigs = [{ services.prometheus.scrapeConfigs = [
{
job_name = "loki"; job_name = "loki";
static_configs = [ static_configs = [
{ {
targets = ["localhost:3100"]; targets = ["localhost:3100"];
} }
]; ];
}]; }
services.promtail = { ];
services.alloy = {
enable = true; enable = true;
# https://grafana.com/docs/loki/latest/send-data/promtail/configuration/
configuration = {
server = {
http_listen_port = 9080;
grpc_listen_port = 0;
}; };
clients = [ environment.etc."alloy/config.alloy" = {
{url = "http://localhost:3100/loki/api/v1/push";} text = ''
]; discovery.relabel "system" {
scrape_configs = [ targets = []
{
job_name = "system"; rule {
journal = { source_labels = ["__journal__systemd_unit", "__journal__systemd_user_unit"]
path = "/var/log/journal/"; regex = "(.+)"
target_label = "systemd_unit"
}
rule {
source_labels = ["__journal__priority_keyword"]
regex = "(.+)"
target_label = "severity"
}
}
loki.source.journal "system" {
max_age = "1h0m0s"
path = "/var/log/journal/"
relabel_rules = discovery.relabel.system.rules
forward_to = [loki.write.default.receiver]
labels = {}
}
loki.write "default" {
endpoint {
url = "http://localhost:3100/loki/api/v1/push"
}
max_streams = 24
}
'';
}; };
relabel_configs = [ services.grafana.provision.datasources.settings.datasources = [
{ {
source_labels = ["__journal_message"];
target_label = "message";
regex = "(.+)";
}
{
source_labels = ["__journal__systemd_unit"];
target_label = "systemd_unit";
regex = "(.+)";
}
{
source_labels = ["__journal__systemd_user_unit"];
target_label = "systemd_user_unit";
regex = "(.+)";
}
{
source_labels = ["__journal__transport"];
target_label = "transport";
regex = "(.+)";
}
{
source_labels = ["__journal__priority_keyword"];
target_label = "severity";
regex = "(.+)";
}
];
}
];
};
};
services.grafana.provision.datasources.settings.datasources = [{
name = "Loki"; name = "Loki";
type = "loki"; type = "loki";
url = "http://localhost:${toString loki.configuration.server.http_listen_port}"; url = "http://localhost:${toString loki.configuration.server.http_listen_port}";
}]; }
];
} }

13
nixos/services/nfs.nix Normal file
View file

@ -0,0 +1,13 @@
{config, ...}: {
services.nfs = {
settings = {
mountd.manage-gids = true;
};
server = {
enable = true;
exports = ''
/mnt/storage/media 100.106.241.122/8(rw,fsid=root)
'';
};
};
}