Public bug reported:
## Summary
Service stdout/stderr is not recorded by systemd-journald when
`StandardOutput=journal` is used.
Logging through `/dev/log` (e.g. using `logger`) continues to work
normally.
The issue affects all systemd services.
## Environment
* Ubuntu Server 26.04
* systemd 259.5-0ubuntu3
```
$ systemctl --version
systemd 259 (259.5-0ubuntu3)
```
## Expected behavior
When a service is started with `StandardOutput=journal` (or the default
service configuration), anything written to stdout/stderr should appear
in the systemd journal.
For example:
```bash
systemd-run \
--unit=test-journal \
--property=StandardOutput=journal \
/bin/sh -c 'echo stdout; echo stderr >&2'
```
should produce journal entries containing:
```
stdout
stderr
```
## Actual behavior
No journal entries are created.
The following commands return no output:
```bash
journalctl -u test-journal
journalctl | grep stdout
journalctl _PID=<service-pid>
```
The same behavior occurs for long-running services such as Grafana
Alloy.
## Investigation
The following observations were made.
### 1. journald is running normally
```
systemctl status systemd-journald
```
shows the service is active.
### 2. syslog logging works
```
logger test123
```
The message is successfully recorded in the journal.
This indicates that the `/dev/log` path is working correctly.
### 3. stdout/stderr is connected to the journal socket
For the Alloy process:
```
/proc/<pid>/fd/1 -> socket:[...]
/proc/<pid>/fd/2 -> socket:[...]
```
Both stdout and stderr are connected to the systemd journal stream
socket.
The journal stdout socket also exists and is listening:
```
/run/systemd/journal/stdout
```
```
ss -xlp | grep /run/systemd/journal/stdout
```
shows both PID 1 (systemd) and systemd-journald listening on the socket.
### 4. StandardOutput=file works
Running
```bash
systemd-run \
--unit=test-file \
--property=StandardOutput=file:/tmp/test.out \
--property=StandardError=file:/tmp/test.err \
/bin/sh -c 'echo stdout; echo stderr >&2'
```
creates:
```
/tmp/test.out
stdout
/tmp/test.err
stderr
```
This indicates that systemd successfully captures the child process
stdout/stderr.
Only `StandardOutput=journal` fails.
### 5. Recovery
In the past, restarting systemd-journald restored normal operation:
```bash
systemctl restart systemd-journald
```
Although the issue has not yet been reproduced while collecting
diagnostics, this workaround has consistently restored stdout/stderr
logging previously.
## Impact
All services relying on `StandardOutput=journal` lose stdout/stderr
logging.
Applications such as Grafana Alloy appear to stop logging even though
they continue writing to stdout when started interactively.
** Affects: systemd (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2160529
Title:
systemd services with StandardOutput=journal produce no journal
entries while syslog logging still works
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2160529/+subscriptions
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs