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

Merge branch 'ops#221.journald-log-retention' into 'develop'

Configure journald to discard logs before they're older than 30 days

Closes privatestorageops#221

See merge request !285
parents 97de3adf dcb65d82
No related branches found
No related tags found
2 merge requests!293merge develop into production,!285Configure journald to discard logs before they're older than 30 days
Pipeline #2014 passed
......@@ -32,6 +32,29 @@ in {
config = lib.mkIf cfg.enable {
services.promtail.enable = true;
networking.firewall.interfaces.monitoringvpn.allowedTCPPorts = [ 9080 ];
# Since we'll send our journald logs elsewhere, we don't need to keep them
# here for very long. Keep them for a *little* while just to provide some
# context in case someone ends up looking at the logs on the system itself
# but generally suppose that people will look at Loki instead.
services.journald.extraConfig = ''
# This tells journald it can discard log files that contain only log
# entries that are older than 29 days.
MaxRetentionSec=29day
# This tells journald to start a new log file once a day. Together with
# the MaxRetentionSec setting, this means that entries are kept for
# between 29 and 30 days (plus whatever scheduling slop journald has in
# enforcing these limits).
#
# https://www.freedesktop.org/software/systemd/man/journald.conf.html
# for further details about these options.
#
# A maximum retention of 30 days conforms to the published log retention
# policy.
MaxFileSec=1day
'';
services.promtail.configuration = {
server = {
http_listen_port = 9080; # Using /metrics for health check
......
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