GuidesMonitor

Logs

Send structured logs from Sentry SDKs to Rustrak and search them per project, to see what your app was doing before an error happened.

Logs are the structured lines your app writes as it runs: “order created”, “carrier quote took 900 ms”. Rustrak keeps them per project under Logs, apart from issues, so you can see what the app was doing before something broke. They are not grouped: every line is stored and shown as it came.

Send logs

Logs are off by default in Sentry SDKs. Turn them on in Sentry.init and use the SDK’s logger:

import * as Sentry from '@sentry/node';

Sentry.init({
  dsn: 'YOUR_DSN',
  enableLogs: true,
});

Sentry.logger.info('Order created', { orderId: 9182, total: 54.9 });
Sentry.logger.warn('Carrier quote slow', { carrier: 'dhl', ms: 1830 });
Sentry.logger.error('Payment webhook signature mismatch');
JavaScript

Rustrak takes Sentry’s log envelope item, so any SDK version that sends logs works. Older JavaScript SDKs put the switch under _experiments: { enableLogs: true }. The SDK sends logs in batches, so they show up a few seconds later; call Sentry.flush() before a script exits.

Each line keeps its level, message, timestamp and attributes, each attribute with its type. A line written inside an active span also carries the span’s trace and span IDs.

The SDK adds a few attributes of its own to every line, among them sentry.environment and sentry.release. Rustrak reads the environment into a field of its own, so the list can be filtered by it. SDKs send production unless you set environment in Sentry.init. A line that arrives without one has no environment, the way Sentry leaves it.

Levels

LevelSeverity number
trace1
debug5
info9
warn13
error17
fatal21

A line sent without a level is stored as info. An unknown level is kept as sent, with no severity number.

Find a line

Logs shows the newest lines first, in a table of time, level, message and environment, with a chart of the volume by level above it.

  • Type in the search bar to find lines whose message contains the text, ignoring case.
  • level:error keeps one level; trace:<trace id> keeps one trace.
  • Environment keeps the lines of one environment. It lists every environment the project has seen in issues, sessions and logs.
  • The window button (14d by default) sets how far back to look.

Every filter is in the address, so a reload or a shared link shows the same lines.

Save a search you repeat as a view.

Click a line to open it in place, under its row. It shows the whole message, then its time, environment, trace and span, then its attributes grouped by namespace (sentry, service and so on). Hover a value to copy it, or click Copy JSON for the whole line. j and k move to the next and previous line, and Esc closes it.

The filter button beside the environment or the trace narrows the list to it. The trace filter keeps the others, so remove level: to see every line of the request.

Loading demo…

API

Read logs with an API token:

curl -H "Authorization: Bearer $RUSTRAK_TOKEN" \
  "$RUSTRAK_URL/api/projects/3/logs?level=error&query=renewal&period=7d&per_page=50"
Shell
ParameterWhat it does
levelOne level
trace_idOne trace
environmentOne environment, as the SDK sent it
queryMessage contains this text, ignoring case
periodWindow such as 24h, 7d, 14d. All time when absent
page, per_pagePagination. per_page is 20 by default, at most 100

GET /api/projects/{id}/logs/{log_id} returns one line and GET /api/projects/{id}/logs/volume the counts behind the chart. The MCP server reads logs too.

Logs count toward storage and are removed by retention like the rest of the data. See Storage.

Esc

Type to search guides, configuration and the API.