`miren logs system` drops structured log attributes
Problem
miren logs system output lacks structured attributes (like module, level, err, etc.), making the logs much less useful than viewing them via journalctl on the host. The bare message text is shown without any of the key-value context that slog attaches.
Example — miren logs system output:
S 2024-01-15 10:30:45: starting reconciliation
Compared to journalctl on the host:
level=INFO module=scheduler msg="starting reconciliation" app=myapp duration=2.3s
Root Cause
Two layers strip attributes:
toLogEntry()inservers/logs/logs.go:26-35— When converting fromobservability.LogEntry(which has a fullAttributes map[string]string) to the RPCLogEntry, only thesourceattribute is extracted. All others (module,level,err, custom fields) are silently discarded.LogEntryRPC type inapi/app/rpc.yml:281-294— Only has fields fortimestamp,line,stream, andsource. No field exists for arbitrary attributes/metadata.
Data Flow
slog.Logger (attrs: module="scheduler", err="timeout", etc.)
→ SystemLogHandler writes full attrs to VictoriaLogs ✅ stored
→ VictoriaLogs returns entries with all attrs ✅ available
→ toLogEntry() copies only "source" attr ❌ dropped here
→ LogEntry RPC type has no attrs field ❌ can't carry them
→ printLogEntry() shows: "S 2024-01-15 10:30:45: msg" ❌ no context
The SystemLogHandler (observability/system_log_handler.go:43-56) correctly collects all slog attributes and writes them to VictoriaLogs. The data is there; it just doesn't make it through to the CLI.
Suggested Fix
- Add an
attributesmap field to theLogEntryRPC type inapi/app/rpc.yml - Update
toLogEntry()inservers/logs/logs.goto populate attributes fromentry.Attributes - Update
printLogEntry()incli/commands/logs.goto display attributes (e.g. askey=valuepairs after the message)