]> git.ipfire.org Git - thirdparty/systemd.git/commit
portable: add PORTABLE_NAME_AND_VERSION= and other metadata to LogsExtraFields=
authorLuca Boccassi <bluca@debian.org>
Thu, 23 Mar 2023 01:23:04 +0000 (01:23 +0000)
committerLuca Boccassi <bluca@debian.org>
Tue, 28 Mar 2023 11:14:21 +0000 (12:14 +0100)
commite8114a4f86efa9a176962bbebbba4cb8b5a1c322
tree09804e452622faaa605af71e42e8a676ef625674
parent8c8331fc5075c2d82b13fb121b2571a12d1c54a0
portable: add PORTABLE_NAME_AND_VERSION= and other metadata to LogsExtraFields=

This is useful to identify log messages with metadata from the images
they run on. Look for ID/VERSION_ID/IMAGE_ID/IMAGE_VERSION/BUILD_ID,
with a SYSEXT_ prefix if we are looking at an extension, and append via
LogExtraFields= as respectively PORTABLE_NAME_AND_VERSION= in case of a
single image. In case of extensions, append as PORTABLE_ROOT_NAME_AND_VERSION=
for the base and one PORTABLE_EXTENSION_AND_VERSION= for each extension.

Example with a base and two extensions, with the unit coming from the
first extension:

[Service]
RootImage=/home/bluca/git/systemd/base.raw
Environment=PORTABLE=app0.raw
BindReadOnlyPaths=/etc/os-release:/run/host/os-release
LogExtraFields=PORTABLE=app0.raw
Environment=PORTABLE_ROOT=base.raw
LogExtraFields=PORTABLE_ROOT=base.raw
LogExtraFields=PORTABLE_ROOT_NAME_AND_VERSION=debian_10

ExtensionImages=/home/bluca/git/systemd/app0.raw
LogExtraFields=PORTABLE_EXTENSION=app0.raw
LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_0

ExtensionImages=/home/bluca/git/systemd/app1.raw
LogExtraFields=PORTABLE_EXTENSION=app1.raw
LogExtraFields=PORTABLE_EXTENSION_NAME_AND_VERSION=app_1
docs/PORTABLE_SERVICES.md
src/portable/portable.c
test/test-functions
test/units/testsuite-29.sh