aboutsummaryrefslogtreecommitdiff
path: root/src/libutil/logging.cc
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2022-01-31 22:05:28 +0100
committerMaximilian Bosch <maximilian@mbosch.me>2022-02-28 17:27:52 +0100
commit7a04839ea53986a0175bf085e7d061ab8a32d59b (patch)
treedac2874a8a051781960ec9abec97148252663238 /src/libutil/logging.cc
parentb592359c565e0220545ba146b32f367e4ecdb23f (diff)
ssh-ng: also store build logs to make them accessible by `nix log`
Right now when building a derivation remotely via $ nix build -j0 -f . hello -L --builders 'ssh://builder' it's possible later to read through the entire build-log by running `nix log -f . hello`. This isn't possible however when using `ssh-ng` rather than `ssh`. The reason for that is that there are two different ways to transfer logs in Nix through e.g. an SSH tunnel (that are used by `ssh`/`ssh-ng` respectively): * `ssh://` receives its logs from the fd pointing to `builderOut`. This is directly passed to the "log-sink" (and to the logger on each `\n`), hence `nix log` works here. * `ssh-ng://` however expects JSON-like messages (i.e. `@nix {log data in here}`) and passes it directly to the logger without doing anything with the `logSink`. However it's certainly possible to extract log-lines from this format as these have their own message-type in the JSON payload (i.e. `resBuildLogLine`). This is basically what I changed in this patch: if the code-path for `builderOut` is not reached and a `logSink` is initialized, the message was successfully processed by the JSON logger (i.e. it's in the expected format) and the line is of the expected type (i.e. `resBuildLogLine`), the line will be written to the log-sink as well. Closes #5079
Diffstat (limited to 'src/libutil/logging.cc')
0 files changed, 0 insertions, 0 deletions