Skip to content

All docs

Logs

Structured logging

Public Surface stores logs as structured events rather than raw text. Sending JSON instead of plain strings makes every field individually queryable.

Why structure logs

A structured log line lets you filter on fields like status code or user id directly, instead of writing fragile text search queries.

{
  "level": "error",
  "message": "payment declined",
  "service": "checkout-api",
  "user_id": "usr_881",
  "trace_id": "9f2c1e"
}
{
  "level": "error",
  "message": "payment declined",
  "service": "checkout-api",
  "user_id": "usr_881",
  "trace_id": "9f2c1e"
}
{
  "level": "error",
  "message": "payment declined",
  "service": "checkout-api",
  "user_id": "usr_881",
  "trace_id": "9f2c1e"
}

Reserved fields

A small set of field names are reserved and power built-in filters across the dashboard: timestamp, level, service, and trace_id.

Once logs are structured, configure how long they are kept in Log retention & storage classes.

Create a free website with Framer, the website builder loved by startups, designers and agencies.