systemd: serve kernel-log, the kernel's messages of one boot (issue 1975)

journalctl --dmesg --boot=N under the same escalation, window, priority, fixed-string match, 2000-line cap
and redaction as the journal verb (shapeLines is the one filter both use); a boot is 0 or a negative whole
number, refused otherwise before anything runs. No scope: the kernel belongs to no manager.

Builds: issue 1975, the operator's request of 2026-11-12 (the lead's handover; no design line names the verb)

Claude-Session: https://claude.ai/code/session_01NcbgfGKaxw984XyAPfLm4h
This commit is contained in:
2026-11-12 02:17:28 +01:00
parent d9f2b7bcfa
commit 3ebcb15a4b
6 changed files with 190 additions and 27 deletions
+18
View File
@@ -124,6 +124,24 @@ func tools(m *Manager) []stdio.Tool {
}
return m.Journal(scope, unit, q)
}},
{Name: seat + ".kernel-log",
Description: "The kernel's messages (what journalctl -k and dmesg give) of this boot or an earlier one, at most 2000 lines, " +
"in a time window and narrowed to a priority and to lines holding a text when asked. A secret a line held is " +
"shown as [redacted: <what it was>].",
Input: map[string]any{
"boot": str("which boot: 0 this boot (the default), -1 the one before, -2 the one before that, and so on (optional)"),
"lines": str("how many lines from the end of what matches (default 100, at most 2000)"),
"since": str("the window's start: an RFC 3339 time (2026-10-07T09:30:00Z) or relative to now (-30min, -2h, yesterday) (optional)"),
"until": str("the window's end, in the same forms (optional; now when absent)"),
"match": str("only the lines holding this text, as written — a fixed string, not a pattern (optional)"),
"priority": str("only entries this severe or more: 0-7 or emerg, alert, crit, err, warning, notice, info, debug (optional)")},
Run: func(a map[string]any) (any, error) {
q, err := journalQuery(a)
if err != nil {
return nil, err
}
return m.KernelLog(q)
}},
// **Clearing a failed record** (novox/hq issue 332): a unit whose file is gone keeps its failed state,
// and its start-limit count, in its manager until it is reset. A unit's name is required, so the
// verb never resets every failed unit at once.