Skip to Content

Logs

The logging system captures server-side activity into an in-memory ring buffer with REST and SSE streaming access. Logs are ideal for debugging extensions, cron jobs, and API calls without needing external log aggregation.

In the Studio, the Logs page shows the entries as they arrive. Search the messages, or filter by level and source. The buttons at the top pause the live stream, refresh the list, and clear the logs.

Application Logs page filtered by the search term cron

On the Buildpad Engine backend, the logs are the Engine’s. The Engine keeps them in a ring buffer in Valkey, shared by its processes, and each tenant sees its own lines. Send the requests below to the Engine. The Engine’s entries have no id. They carry timestamp, level, source, message and the other fields of the log line, such as correlation_id.

Log Entry Structure

interface LogEntry { id: string; // Unique entry ID timestamp: string; // ISO timestamp level: 'debug' | 'info' | 'warn' | 'error'; source: 'extension' | 'api' | 'emitter' | 'database' | 'auth' | 'system'; message: string; data?: Record<string, any>; // Optional structured data extensionId?: string; extensionName?: string; collection?: string; requestId?: string; userId?: string; }

Configuration

Environment variableDefaultDescription
LOG_MAX_ENTRIES1000Ring buffer size. Supabase backend only. The Engine has its own log settings
LOG_MIN_LEVELdebugMinimum log level (debug, info, warn, error)
LOG_CONSOLE_OUTPUTtrueAlso write to stdout

REST API

Get logs

GET /api/logs

Requires authentication (unauthenticated requests receive 401). Access is granted to admins and to any user whose policy grants the system:logs module access key (Policy editor → Module-Level Access); other users receive 403. The key is global: a policy that grants it at any scope gives access under every scope, since there is one log buffer per server. The same gate applies to GET /api/logs/stream. Clearing logs (DELETE /api/logs) remains admin-only.

Query parameters:

ParameterDescriptionExample
limitNumber of entries to return (default: 50, max: 500)?limit=100
levelFilter by level?level=error
sourceFilter by source?source=extension
extensionIdFilter by extension UUID?extensionId=<uuid>
extensionNameFilter by extension name (partial match)?extensionName=slug
collectionFilter by collection?collection=articles
sinceEntries after this timestamp or relative time (1h, 30m, 1d)?since=2025-01-01T00:00:00Z
untilEntries before this timestamp?until=2025-01-02T00:00:00Z
searchText search in message?search=validation

On the Engine, extensionId, collection, since, until and search are not available. A request that uses one gets 400, so that a filter is never ignored. level, source, extensionName and limit work as shown. ?action=stats returns counts by level and by source.

Response:

{ "data": { "count": 1, "entries": [ { "id": "log-uuid", "timestamp": "2025-01-15T10:00:00Z", "level": "error", "source": "extension", "message": "Validation failed: title is required", "extensionName": "article-validator", "collection": "articles" } ] } }

Clear logs

DELETE /api/logs

Clears all log entries from the in-memory buffer. Requires admin access.

Stream logs (SSE)

GET /api/logs/stream

Returns a text/event-stream response. Each new log entry is pushed as a Server-Sent Event. Supports level, source, and extensionName query parameters for filtering.

On the Engine, a browser EventSource cannot send an Authorization header. Get a ticket first with POST /api/logs/stream/ticket (with the bearer token), then open /api/logs/stream?ticket=<ticket>. A ticket works once and lives 60 seconds.

const es = new EventSource('/api/logs/stream?level=error', { headers: { Authorization: `Bearer ${token}` }, }); es.onmessage = (event) => { const entry = JSON.parse(event.data); console.log(entry.message); };

MCP Tool

The Engine’s MCP server has no logs tool. Use GET /api/logs instead.

The logs MCP tool exposes log access to AI agents. The tool is admin-only — all actions (including tail and read) require an admin token; the system:logs key applies to the REST API and Logs page only.

// Tail the last 50 entries { "action": "tail", "lines": 50, "level": "error" } // Read with filters { "action": "read", "since": "2025-01-15T00:00:00Z", "source": "extension" } // Search log messages { "action": "search", "query": "validation failed", "source": "extension" } // Get buffer statistics { "action": "stats" } // Clear all logs (admin only) { "action": "clear" }

The log buffer is in-memory and is cleared on server restart. In clustered deployments each worker process keeps its own buffer, so /api/logs, the SSE stream, and the Logs page show only the output of the worker that happened to serve your request. For persistent and complete log storage, aggregate container stdout — every worker echoes its logs to the console when LOG_CONSOLE_OUTPUT is enabled (the default), so stdout captures the whole cluster.