systemlog

package
v0.0.0-...-3c87a54 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
const Category = "system"

Category is the slog attribute value on every request line.

Variables

This section is empty.

Functions

func CaptureRoute

func CaptureRoute(next http.Handler) http.Handler

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

func Middleware(logger *slog.Logger) func(http.Handler) http.Handler

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

func StampCategory(next slog.Handler) slog.Handler

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL