Skip to content
Snippets Groups Projects
Commit d2e5cdde authored by Florian Sesser's avatar Florian Sesser
Browse files

Use log retention setting in promtail and loki config

parent 97238d50
No related branches found
No related tags found
2 merge requests!298merge develop into production,!290Log retention policy module
......@@ -11,6 +11,7 @@
let
cfg = config.services.private-storage.monitoring.exporters.promtail;
hostName = config.networking.hostName;
logRetention = toString(config.services.private-storage.monitoring.policy.logRetentionSeconds) + "s";
in {
options.services.private-storage.monitoring.exporters.promtail = {
......@@ -40,7 +41,7 @@ in {
services.journald.extraConfig = ''
# This tells journald it can discard log files that contain only log
# entries that are older than 29 days.
MaxRetentionSec=29day
MaxRetentionSec=${logRetention}
# This tells journald to start a new log file once a day. Together with
# the MaxRetentionSec setting, this means that entries are kept for
......
......@@ -7,7 +7,11 @@
# 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 = {
......@@ -61,7 +65,7 @@
table_manager = {
retention_deletes_enabled = true;
retention_period = "336h"; # two weeks
retention_period = logRetention;
};
};
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment