]> git.ipfire.org Git - thirdparty/systemd.git/commit
nspawn: add --forward-journal= and --forward-journal-*= options
authorDaan De Meyer <daan@amutable.com>
Sun, 29 Mar 2026 11:15:35 +0000 (11:15 +0000)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Wed, 22 Apr 2026 18:05:38 +0000 (20:05 +0200)
commitcc8f398202e3455a93fd79be8e454e6beedd7989
tree22a72c5e7e711f1a9f1da6836ef820fa732c2390
parent012d87c1fc3f22d7bc23a4389e710082c6666fc5
nspawn: add --forward-journal= and --forward-journal-*= options

Add --forward-journal=FILE|DIR to forward the container's journal
entries to the host via systemd-journal-remote. When specified,
nspawn starts systemd-journal-remote listening on a Unix socket,
bind-mounts it into the container at /run/host/journal/socket, and
passes a journal.forward_to_socket credential pointing to it.

Add --forward-journal-max-use=, --forward-journal-keep-free=,
--forward-journal-max-file-size=, and --forward-journal-max-files=
to configure disk usage limits for the forwarded journal.

Consolidate nspawn's per-machine on-disk state under a single runtime
directory at /run/systemd/nspawn/<machine>/. The container rootdir
mount point moves from /tmp/nspawn-root-XXXXXX to <runtime_dir>/root,
the unix-export directory moves from
/run/systemd/nspawn/unix-export/<machine> to <runtime_dir>/unix-export,
and the journal-remote socket lives at
<runtime_dir>/journal-remote-socket. Update ssh-generator and
ssh-proxy to follow the new unix-export path layout.

Extract fork_journal_remote() into fork-notify.{c,h} as a shared
helper used by both nspawn and vmspawn, replacing vmspawn's
start_systemd_journal_remote().

Extract runtime_directory_make() into path-lookup.{c,h} as a shared
helper used by both nspawn and vmspawn, replacing vmspawn's inline
runtime directory creation logic.

Co-developed-by: Claude Opus 4.6 <noreply@anthropic.com>
man/systemd-nspawn.xml
shell-completion/bash/systemd-nspawn
shell-completion/zsh/_systemd-nspawn
src/libsystemd/sd-path/path-lookup.c
src/libsystemd/sd-path/path-lookup.h
src/nspawn/nspawn.c
src/shared/fork-notify.c
src/shared/fork-notify.h
src/ssh-generator/ssh-generator.c
src/ssh-generator/ssh-proxy.c
src/vmspawn/vmspawn.c