about summary refs log tree commit diff
path: root/nixos/modules/system
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2023-11-03 18:21:50 +0100
committerBjørn Forsman <bjorn.forsman@gmail.com>2023-11-07 14:06:27 +0100
commit0597d1d1796332af7ef24ad7d685badf9bcf0e63 (patch)
tree3f7b7b15b93b1c83d051af194395f4878ae1ce6f /nixos/modules/system
parentdf4f0296d7947ee9a228d99c21cd8875c64148b8 (diff)
downloadnixlib-0597d1d1796332af7ef24ad7d685badf9bcf0e63.tar
nixlib-0597d1d1796332af7ef24ad7d685badf9bcf0e63.tar.gz
nixlib-0597d1d1796332af7ef24ad7d685badf9bcf0e63.tar.bz2
nixlib-0597d1d1796332af7ef24ad7d685badf9bcf0e63.tar.lz
nixlib-0597d1d1796332af7ef24ad7d685badf9bcf0e63.tar.xz
nixlib-0597d1d1796332af7ef24ad7d685badf9bcf0e63.tar.zst
nixlib-0597d1d1796332af7ef24ad7d685badf9bcf0e63.zip
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.
Diffstat (limited to 'nixos/modules/system')
-rw-r--r--nixos/modules/system/boot/systemd/journald.nix11
1 files changed, 10 insertions, 1 deletions
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 != "") ''