webui: add Maintenance > Logs viewer

New Logs page under Maintenance presents the on-disk syslog files
(messages, syslog, kern, auth, routing, firewall, upgrade, debug,
container, mail) with a tab per source and an (empty) chip for files
with no content.

The buffer loads the last 250 lines and pins to the bottom on open and
on tab change, with keyboard focus on the pane so PageUp/PageDown work
immediately.  Load earlier pages back 250 lines at a time, preserving
the reader's scroll position as older lines fill in above; once the
current file is exhausted the button re-labels to "Load previous from
<rotation>" and walks back through rotated and gzipped archives.

Live tail streams new entries over SSE.  The server runs tail -F -n 0
and debounces output; the client follows the bottom unless the reader
has scrolled up.  A status pill shows connecting/live/disconnected.
nginx gets a no-buffering location for the tail stream, mirroring the
software progress endpoint.

Download returns the full archive — current file plus every rotated and
gzipped predecessor — concatenated chronologically.

Severity is coloured by a keyword heuristic since sysklogd writes no
<PRI> to disk; BSD-format lines are shown unconditionally.  Filter is
client-side substring or /regex/, focusable with Ctrl/Cmd-F.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg
2026-06-15 19:45:22 +02:00
parent 10ab88d93f
commit b1146cbb31
11 changed files with 1125 additions and 3 deletions
+11
View File
@@ -34,6 +34,17 @@ location = /software/progress {
include /etc/nginx/webui-proxy.conf;
}
# SSE live-tail stream for Maintenance > Logs. Same buffering / timeout
# concerns as the software progress stream: nginx must not buffer the
# event frames, and the connection has to stay open through quiet logs.
# The Go side sends a 15 s heartbeat, so 600 s of read timeout is plenty
# of safety margin.
location ~ ^/maintenance/logs/[^/]+/tail$ {
proxy_read_timeout 600s;
proxy_buffering off;
include /etc/nginx/webui-proxy.conf;
}
# Liveness probe — nginx-only, no upstream call. Used by the watchdog
# div in base.html and the reboot-overlay poller.
location = /device-status {