feat: a bit of cleanup & keeping 15 days of metrics/logs

This commit is contained in:
Xavier Morel
2025-11-16 00:20:05 +01:00
parent 6578f1a626
commit 7f8f83271a
7 changed files with 41 additions and 90 deletions

View File

@@ -22,10 +22,30 @@
logging = {
enable = true;
metricsEnable = true;
alloyConfig = {
# probably move to default-journal...
"logs-traefik" = ../config/alloy/proxy-traefik.alloy.nix;
};
prometheusPorts.traefik = 8082;
journalLoggers.traefik = ''
stage.regex {
expression = "^(?P<client_ip>\\S+) (?P<ident>\\S+) (?P<auth_id>\\S+) \\[(?P<timestamp>[^\\]]+)\\] \"(?P<method>\\S+) (?P<path>\\S+) HTTP/(?P<http_version>\\S+)\" (?P<status>\\d+) (?P<bytes_sent>\\d+) \"(?P<referrer>[^\"]*)\" \"(?P<user_agent>[^\"]*)\" (?P<bytes_received>\\d+) \"(?P<router>[^\"]*)\" \"(?P<upstream>[^\"]*)\" (?P<duration>\\d+)ms$"
}
stage.timestamp {
source = "timestamp"
format = "02/Jan/2006:15:04:05 -0700"
}
stage.labels {
values = {
client_ip = "",
ident = "",
auth_id = "",
method = "",
status = "",
referrer = "",
router = "",
upstream = "",
}
}
'';
};
private = true;
auth = true;