From 90ac9f2efae10e34dc121f562b123a3f2aa6743d Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Tue, 23 Jun 2020 13:43:59 -0400
Subject: [PATCH] Turn on Eliot logging on storage servers

---
 nixos/modules/tahoe.nix                 | 3 ++-
 nixos/modules/tests/private-storage.nix | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/nixos/modules/tahoe.nix b/nixos/modules/tahoe.nix
index 8ea35886..e362077e 100644
--- a/nixos/modules/tahoe.nix
+++ b/nixos/modules/tahoe.nix
@@ -176,6 +176,7 @@ in
             # This is a directory, but it has no trailing slash. Tahoe commands
             # get antsy when there's a trailing slash.
             nodedir = "/var/db/tahoe-lafs/${lib.escapeShellArg node}";
+            eliotLog = "file:${nodedir}/logs/eliot.json,rotate_length=${toString (1024 * 1024 * 32)},max_rotated_files=32";
           in nameValuePair "tahoe.${node}" {
             description = "Tahoe LAFS node ${node}";
             wantedBy = [ "multi-user.target" ];
@@ -189,7 +190,7 @@ in
               # arguments to $(tahoe run). The node directory must come first,
               # and arguments which alter Twisted's behavior come afterwards.
               ExecStart = ''
-                ${settings.package}/bin/tahoe run ${nodedir} -n -l- --pidfile=${pidfile}
+                ${settings.package}/bin/tahoe --eliot-destination ${eliotLog} run ${nodedir} -n -l- --pidfile=${pidfile}
               '';
               # The rlimit on number of open files controls how many
               # connections a particular storage server can accept (factoring
diff --git a/nixos/modules/tests/private-storage.nix b/nixos/modules/tests/private-storage.nix
index 47acfbf4..8c163785 100644
--- a/nixos/modules/tests/private-storage.nix
+++ b/nixos/modules/tests/private-storage.nix
@@ -226,6 +226,9 @@ import <nixpkgs/nixos/tests/make-test.nix> {
       # status from the node if it is really working.
       $storage->succeed('tahoe -d /var/db/tahoe-lafs/storage status');
 
+      # It should have Eliot logging turned on as well.
+      $storage->succeed('[ -e /var/db/tahoe-lafs/storage/logs/eliot.json ]');
+
       #
       # Storage appears to be working so try to get a client to speak with it.
       #
-- 
GitLab