Skip to main content
Log export sends your functions’ log lines to an outside service as they are written, so you can keep a longer history, search it and alert on it. There is one export with two sinks:
  • OpenTelemetry: OTLP/HTTP logs, JSON encoded, to an OpenTelemetry Collector or any service that ingests OTLP logs.
  • Webhook: one signed JSON POST per batch to a URL you control.
The most recent lines are also in the console’s Logs page and in bijection list sys.logs.

The installation’s telemetry

Separately from the exports your code declares, every installation sends three streams of its own through one slot, platform.telemetry (otlp@1). The platform installs the export in every program at platform.telemetryExport; your code declares nothing.
  • Logs: every log line, including the lines of refused runs with their refusal code, as OTLP logs of scope bijection.logs.
  • Audit: every public grant’s transitions (issue, revoke) in commit order, as OTLP logs of scope bijection.audit. Each record’s body is the asserted grant, with its sequence, kind and digests as attributes. See sys.grantTransitions.
  • Traces: one span for each top-level mutation run, with a child span for each task it submitted, as OTLP traces. A run a task started is a child of that task’s send span. Queries and nested calls record no span.
Only public facts leave: the export reads under a label of its own, so a line or grant a protected label covers stays inside. Unbound, the streams go to Bijection’s hosted telemetry store, which stamps every record with your installation and meters the records and bytes it accepts. To send them to your own OpenTelemetry collector instead, bind the slot. url is the collector’s OTLP/HTTP base URL: logs and the audit go to <url>/v1/logs, traces to <url>/v1/traces, with credential presented as a bearer.
bindings.ts
A slot has one provider: to fan telemetry out to several sinks, bind your own collector and fan out there. Log lines kept inside the installation, such as sys.logs, stay whatever platform.telemetry is bound to.

Configuring an export

Exports are configured in code. Place one installation of @bijectionhq/library-log-export per sink in your app tree. Each call at a path is its own installation, with its own buffer and status.
bijection/app.ts
Set the values of these declarations with bijection secret set otlpToken and bijection secret set webhookKey. For an OTLP endpoint that uses a named header, pass { header: { name: "x-api-key", secret: otlpToken } }. A sink must be reachable over HTTPS at a public internet address. The installation checks the address each request connects to, including addresses returned by DNS, and refuses loopback, private network, link-local, cloud instance metadata, shared carrier (CGNAT) and other reserved addresses.

What is exported

Each exported line is a sys.logs line: one line one function logged with console.debug, info, log, warn or error, whether its run committed or was refused.

OpenTelemetry records

Each batch is one OTLP ExportLogsServiceRequest, with your resource attributes as its resource (plus bijection.installation) and one scope, bijection.logs. Each line is one log record:

Webhook body

code and reason are left out when the run ended ok. sequence numbers the installation’s batches in order.

Securing webhooks

Every webhook request is signed as Standard Webhooks with the installation’s key. The webhook-id header is the batch’s identity, the same on every attempt of that batch. webhook-timestamp is the send time, and webhook-signature is the HMAC-SHA256 signature of <webhook-id>.<webhook-timestamp>.<body>. To rotate the key, make the receiver accept both keys, set the new value with bijection secret set webhookKey, then retire the old one. Verify a request with any Standard Webhooks library before trusting its body, and refuse a webhook-timestamp outside a few minutes to prevent replays:

Delivery

Every tick the export reads the newest lines its label clears, takes the ones logged since the last tick and buffers them in order. Then, while fewer than four batches are unsettled, it sends the oldest buffered lines as one batch.
  • A 2xx answer delivers the batch. An OpenTelemetry partial success delivers it less the records it rejects.
  • Another 4xx rejects the batch, and its lines are dropped.
  • A 5xx, a 408 or 429, a failed connection or a lost reply is tried again with the same body after a backoff (5 seconds, doubling, at most 5 minutes), until the batch’s oldest line is a day old.
Delivery is at least once: a lost reply is sent again, so deduplicate on webhook-id or log.record.uid. Batches can arrive out of order; use sequence or the timestamps. When a sink is down, lines wait in the buffer for up to a day. A full buffer drops new lines. One tick reads at most 256 lines. If an installation commits more than that between two ticks, the lines below the read are not exported, and the export counts a gap. Shorten every for an installation that logs that much.

Status

Each installation answers status: its sink and endpoint, the lines buffered and in flight, the oldest unsent line (the lag), and how many lines were delivered, rejected, refused, expired or dropped, how many gaps it counted, its last delivery and its last error. Read it with bijection query logs.status, or in the console under Settings → Integrations, where the log export card shows it for the path you name. The console shows status only; configuration stays in code.