From 0597d1d1796332af7ef24ad7d685badf9bcf0e63 Mon Sep 17 00:00:00 2001 From: Maximilian Bosch Date: Fri, 3 Nov 2023 18:21:50 +0100 Subject: nixos/journald: add `storage` option While this can be added via `services.journald.extraConfig`, this option provides proper type-checking and other modules can determine where journal data is stored. This is relevant when using e.g. promtail to send logs to Loki and it should read from `/run/log/journal` if volatile storage is used. --- nixos/modules/system/boot/systemd/journald.nix | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'nixos/modules/system') diff --git a/nixos/modules/system/boot/systemd/journald.nix b/nixos/modules/system/boot/systemd/journald.nix index 773163bbcb81..7e62a4c9bfed 100644 --- a/nixos/modules/system/boot/systemd/journald.nix +++ b/nixos/modules/system/boot/systemd/journald.nix @@ -28,6 +28,15 @@ in { ''; }; + services.journald.storage = mkOption { + default = "persistent"; + type = types.enum [ "persistent" "volatile" "auto" "none" ]; + description = mdDoc '' + Controls where to store journal data. See + {manpage}`journald.conf(5)` for further information. + ''; + }; + services.journald.rateLimitBurst = mkOption { default = 10000; type = types.int; @@ -100,7 +109,7 @@ in { environment.etc = { "systemd/journald.conf".text = '' [Journal] - Storage=persistent + Storage=${cfg.storage} RateLimitInterval=${cfg.rateLimitInterval} RateLimitBurst=${toString cfg.rateLimitBurst} ${optionalString (cfg.console != "") '' -- cgit 1.4.1