diff options
author | Luca Boccassi <bluca@debian.org> | 2023-03-22 22:44:31 +0000 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2023-03-28 10:36:01 +0100 |
commit | 8c8331fc5075c2d82b13fb121b2571a12d1c54a0 (patch) | |
tree | b3cbb20899ca244d673b171001012b0dc4ccab99 /docs | |
parent | 62b7c23f79bcbcbc141c90c3a0931fa46a1652a2 (diff) | |
download | systemd-8c8331fc5075c2d82b13fb121b2571a12d1c54a0.tar.gz |
portable: include base and extension images in log fields
When a portable service uses extensions, we use the 'main' image name
(the one where the unit was found in) as PORTABLE=. It is useful to
also list all the images actually used at runtime, as they might
contain libraries and so on.
Use PORTABLE_ROOT= for the image/directory that is used as RootImage=
or RootDirectory=, and PORTABLE_EXTENSION= for the image/directory that
is used as ExtensionImages= or ExtensionDirectories=.
Note that these new fields are only added if extensions are used,
there's no change for single-DDI portables.
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
LogExtraFields=PORTABLE_ROOT=base.raw
ExtensionImages=/home/bluca/git/systemd/app0.raw
LogExtraFields=PORTABLE_EXTENSION=app0.raw
ExtensionImages=/home/bluca/git/systemd/app1.raw
LogExtraFields=PORTABLE_EXTENSION=app1.raw
Diffstat (limited to 'docs')
-rw-r--r-- | docs/PORTABLE_SERVICES.md | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/PORTABLE_SERVICES.md b/docs/PORTABLE_SERVICES.md index b12e7754e7..7936eebccb 100644 --- a/docs/PORTABLE_SERVICES.md +++ b/docs/PORTABLE_SERVICES.md @@ -335,6 +335,27 @@ service data may be placed on the host file system. Use `StateDirectory=` in the unit files to enable such behaviour and add a local data directory to the services copied onto the host. +## Logging + +Several fields are autotmatically added to log messages generated by a portable +service (or about a portable service, e.g.: start/stop logs from systemd). +The `PORTABLE=` field will refer to the name of the portable image where the unit +was loaded from. In case extensions are used, additionally there will be a +`PORTABLE_ROOT=` field, referring to the name of image used as the base layer +(i.e.: `RootImage=` or `RootDirectory=`), and one `PORTABLE_EXTENSION=` field per +each extension image used. + +For example, a portable service `app0` using two extensions `app0.raw` and +`app1.raw`, and a base layer `base.raw`, will create log entries with the +following fields: + +``` +PORTABLE=app0.raw +PORTABLE_ROOT=base.raw +PORTABLE_EXTENSION=app0.raw +PORTABLE_EXTENSION=app1.raw +``` + ## Links [`portablectl(1)`](https://www.freedesktop.org/software/systemd/man/portablectl.html)<br> |