Backend
Logging
Esta página aún no está disponible en tu idioma.
A Corabase backend writes one line per event to stdout. In production (NODE_ENV=production, which Corabase Cloud sets) each line is a JSON object; in development it is a readable line in the terminal. LOG_LEVEL (debug, info, warn, error; default info) sets the lowest level written; see Configuration.
The shape of a line
Section titled “The shape of a line”Every production line has the same three keys first, then its fields:
{"severity":"WARNING","message":"request","timestamp":"2026-11-24T16:19:39.685Z","component":"http","method":"GET","path":"/api/data/rooms/RCTF","route":"/api/data/:table/:id","status":404,"latencyMs":16,"requestId":"36ed94d2-…","uid":"9de7e4bd-…","errorCode":"NOT_FOUND"}severityisDEBUG,INFO,WARNINGorERROR.componentnames the part of the runtime the line is about:httpfor requests,cron,schema,auth,cors,boot,entrypoint,websocket,channelbus,cdc,security-auditand others. Messages carry no[Tag]prefix and no emoji, so a filter reads the field, not the text.- A field never overwrites the line’s own keys: one named
message,severityortimestampis written asdata_messageand so on.
Some lines worth knowing:
| Line | Fields |
|---|---|
request (one per request) |
method, path, route (the pattern that answered), status, latencyMs, requestId, uid, collection, errorCode, errorMessage |
Corabase runtime listening on port … |
runtimeVersion, builtAgainst, contract, node, instance, and deploymentId on Corabase Cloud |
Cron job "x" completed in …ms / failed … |
cron, outcome, durationMs, manual, scheduledAt, and result when it is small |
Loaded cron job: x (…) |
cron, schedule, timezone |
| Boot warnings (driver version skew, schema drift) | the facts as fields, and fix: what to run or change |
A 5xx request is logged at ERROR, a 4xx at WARNING unless the answer is routine (a visitor with no session), the rest at INFO.
Writing your own lines
Section titled “Writing your own lines”In a custom function, import logger and pass the facts as fields, not inside the text:
// backend/functions/charge.tsimport { defineFunction, logger } from "@rebasepro/server/functions";
export default defineFunction((app) => { app.post("/", async (c) => { logger.info("charged", { component: "billing", orderId: "o_42", amountCents: 1999 }); return c.json({ ok: true }); });});A line written while a request runs carries that request’s requestId and the caller’s uid without being passed them, so it joins the request’s own line. A console.log is plain text with neither, and a severity filter cannot see it. Values under secret-looking keys (password, token, apiKey, …) are redacted.
In a cron job, ctx.log writes to the same log with the job’s id. Text followed by one object writes the object’s keys as fields:
// backend/crons/score.tsimport { defineCron } from "@rebasepro/server";
export default defineCron({ schedule: "0 * * * *", async handler(ctx) { ctx.log("scored", { leads: 3 }); return { leads: 3 }; },});Reading the log
Section titled “Reading the log”- Studio, Logs: the running process’s recent lines, live. Pick a level (“warn and above”) and a source, search messages and field values, and open a line to see its fields. A request reads as
GET /path 404 · 16 ms. - Corabase Cloud console, Logs: every pod’s output, with level counts, search and the same readable rows. Presets show one kind of line at a time: requests, scheduled jobs, startup or the rest.
- CLI:
rebase cloud logs --runtimeprints each record as one readable line (14:30:32.126 WARN [boot] Driver version skew … fix="…");--level warn,--grep,--since,-fand--raware on the CLI page.rebase logsreads one local process the same way. - Agents: the Corabase Cloud MCP
logstool takeslevel,grep,sinceTimeandprevious, and returns one compact line per record; pass itsnextSinceTimeback assinceTimeto read on from where it stopped.
A pod’s log lives as long as the pod: a redeploy starts a new one. The cron history (rebase cron logs, Studio’s Cron jobs) is kept in the database.