mirror of
https://github.com/henrygd/beszel.git
synced 2026-10-11 21:59:57 +00:00
systemd: include user journals in service logs (#2553)
This commit is contained in:
+4
-1
@@ -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}
|
||||
|
||||
Reference in New Issue
Block a user