systemd: include user journals in service logs (#2553)

This commit is contained in:
Sven van Ginkel
2026-10-11 13:02:38 -04:00
committed by GitHub
parent d324ccc097
commit 4da7d867f2
+4 -1
View File
@@ -374,7 +374,10 @@ func (sm *systemdManager) getServiceLogs(serviceName string) (string, error) {
ctx, cancel := context.WithTimeout(context.Background(), 2100*time.Millisecond)
defer cancel()
cmd := exec.CommandContext(ctx, "journalctl", "--system", "--quiet", "--no-pager", "--output=short-iso", "--unit", unitName, "--lines", strconv.Itoa(systemdLogsTail))
// No --system: journald (SplitMode=uid) stores output from services running
// as a non-system User= in user-UID.journal, which --system excludes.
// --unit still restricts results to the system unit.
cmd := exec.CommandContext(ctx, "journalctl", "--quiet", "--no-pager", "--output=short-iso", "--unit", unitName, "--lines", strconv.Itoa(systemdLogsTail))
output := limitedBuffer{limit: maxTotalLogSize}
cmd.Stdout = &output
stderr := limitedBuffer{limit: 1024}