Replies: 2 comments 1 reply
-
That is not correct, journald does correctly show the containers stdout/err on my fedora system. AFAIK RHEL and rootless journalctl has its problems due to different configurations. I don't think this is really about podman.
According to #26575 --user-unit instead of using --user --unit might work. |
Beta Was this translation helpful? Give feedback.
-
On a fresh Rocky Linux 9.6 minimal install (podman 5.4), everything works as intended with systemd/journald.conf Storage=persistent (and default podman LogDriver). However, I can’t get it working on two other older instances. Journald runs in persistent mode and When I take a look on the working instance, I can see logs from podman like:
and logs from the container:
I must miss a configuration somewhere... What puzzles me is that a regular systemd service works good on all instances: $ cat ~/test-logging.sh
#!/usr/bin/env sh
echo 'Hello World!'
$ cat ~/.config/systemd/user/test-logging.service
[Unit]
Description=Testing logging
[Service]
Type=exec
ExecStart=/home/rootlessstaginguser/test-logging.sh
Restart=always
RestartSec=5s
[Install]
WantedBy=default.target
$ journalctl --user --unit=test-logging
[...]
Aug 19 17:52:35 staging systemd[1201]: test-logging.service: Scheduled restart job, restart counter is at 12.
Aug 19 17:52:35 staging systemd[1201]: Stopped Testing logging.
Aug 19 17:52:35 staging systemd[1201]: Starting Testing logging...
Aug 19 17:52:35 staging systemd[1201]: Started Testing logging.
Aug 19 17:52:35 staging test-logging.sh[79299]: Hello World!
[...] |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have trouble to understand how to manage logs properly with a Quadlet, on a rootless (lingering enabled) user.
As a testing material, I’ve got a simple app (Nodejs) that outputs logs to stdout. This app runs in a Podman container, which OCI image is based on the
docker.io/library/node:lts-alpine
image. The container is managed by systemd (lingered user session) with Quadlet (see *.container file below).What I expect regarding logs management is:
stdout
.So far, I’ve tried two configurations, but none has fulfilled my requirements and I don’t quite understand what configuration should be applied or what am I missing?
Note: all commands where run from the same rootless unprivileged user.
Option A:
LogDriver=journald
journalctl --user --unit=test1 --output=short-iso --utc
This does not show the output from the containerized app, but only the systemd service unit status messages.
AFAIK, this is expected since podman sends the container’s output directly to journald.
podman logs systemd-test1
This shows only the currently running container output, which is the usual behavior from
podman logs
.Problem: when the unit is restarted, a new container is created and
podman logs
does not show logs of previous containers. This is especially unreliable when the app crashes.Option B:
LogDriver=passthrough
journalctl --user --unit=test1 --output=short-iso --utc
This does not show the output from the containerized app, but only the systemd service unit status messages. And this is where I got confused, as I was expecting to see my application logs here.
podman logs systemd-test1
This does not show container output either. Which makes me even more confused: where did go the app output?
Possible related issues: #17482 and #18682
System: Rocky Linux 9.5 (Linux 5.14.0-503.35.1.el9_5.x86_64)
Podman version:
Here is a quadlet file
/home/rootlessstaginguser/.config/containers/systemd/test1.container
:Beta Was this translation helpful? Give feedback.
All reactions