Documentation
¶
Overview ¶
Package systemlog records every inbound HTTP request as a slog line with category=system, except GET /health. The line names who called (caller kind and id), the route, status, and duration. Request and response payloads are not logged: forms are JSON Schema–driven (jsonforms), so field- level redaction cannot list every PII key. RemoteAddr is omitted: behind ingress it is the proxy, and a real client IP would be PII in the pod log.
Authorization headers are not logged. The callback token in /api/v1/callbacks/{token} is replaced in the path.
401 and 403 responses also emit a sparse category=security line (see package securitylog) for alerting; every other status is system-only.
Index ¶
Constants ¶
const Category = "system"
Category is the slog attribute value on every request line.
Variables ¶
This section is empty.
Functions ¶
func CaptureRoute ¶
CaptureRoute records the ServeMux pattern onto the matchedRoute slot that Middleware put in the context. Place it next to the mux so Middleware outside otelhttp still sees pattern after the handler returns.
func Middleware ¶
Middleware logs one system line after next returns, including when next panics. logger nil uses slog.Default. The logger must already be the process handler (with StampCategory) so the line picks up category=system and the request trace id. GET /health is served and not logged.
Wrap the mux with CaptureRoute so pattern is recorded when Middleware sits outside otelhttp (which copies the request before ServeMux sets Pattern).
func StampCategory ¶
StampCategory wraps next so any record that does not already carry a category attribute gets Category ("system"). Security and audit loggers set their own category via WithAttrs; those records are left alone. Bootstrap wraps the process handlers with this so plain slog.* calls are filterable as category=system without each call site setting the attribute.
Types ¶
This section is empty.