StreamTrace BETA
Documentation menu

Installation & Deployment

Configuration reference

Every Stream Trace environment variable, with defaults.

Stream Trace is configured entirely through environment variables prefixed ST_. ST_NATS_URL is required for the normal API/indexer runtime; the isolated ./stream-trace migrate command needs only database and logging settings. When authentication is enabled (the default), normal runtime also needs a JWT key ring.

NATS

VariableDefaultDescription
ST_NATS_URL(required)One validated NATS connection URL. Multiple cluster seed URLs are not supported as a first-class beta configuration.
ST_NATS_MAX_RECONNECTS-1Max reconnect attempts; -1 = unlimited.
ST_NATS_RECONNECT_WAIT_SEC2Seconds between reconnect attempts (1–300).

See Connecting to NATS for URL formats and auth.

Database

VariableDefaultDescription
ST_DB_TYPEsqlitesqlite or postgres.
ST_DB_URLfile:stream-trace.db?_foreign_keys=on&_journal_mode=WAL&_busy_timeout=5000Connection string / DSN. Required for postgres.
ST_DB_AUTO_MIGRATEtrueApply pending migrations during normal startup. The explicit ./stream-trace migrate command always runs migrations.
ST_DB_READ_MAX_OPEN_CONNS10Read pool max open connections.
ST_DB_READ_MAX_IDLE_CONNS5Read pool max idle connections.
ST_DB_READ_CONN_MAX_LIFETIME_SEC300Read connection max lifetime.
ST_DB_READ_CONN_MAX_IDLE_TIME_SEC300Read connection max idle time.
ST_DB_WRITE_MAX_OPEN_CONNS5Write pool max open connections.
ST_DB_WRITE_MAX_IDLE_CONNS5Write pool max idle connections.
ST_DB_WRITE_CONN_MAX_LIFETIME_SEC300Write connection max lifetime.
ST_DB_WRITE_CONN_MAX_IDLE_TIME_SEC300Write connection max idle time.

See Databases.

Runtime & server

VariableDefaultDescription
ST_RUNTIME_MODEapi,indexerComma-separated roles: api, indexer. SQLite requires both together; Postgres can split them.
ST_PORT4000HTTP listen port.
ST_SHUTDOWN_TIMEOUT_SEC20Graceful shutdown timeout (1–300).
ST_LOG_LEVELinfodebug, info, warn, error.
ST_LOG_FORMATjsontext (colored, local) or json.

CORS

VariableDefaultDescription
ST_CORS_ALLOW_ORIGINS*Comma-separated origins, or *.
ST_CORS_ALLOW_METHODSGET,POST,PUT,DELETE,OPTIONSAllowed methods.
ST_CORS_ALLOW_HEADERS*Allowed headers, or *.
ST_CORS_ALLOW_CREDENTIALSfalseInclude credentials in CORS responses.

Authentication (local)

VariableDefaultDescription
ST_AUTH_ENABLEDtrueMaster switch for authentication.
ST_AUTH_LOCAL_ENABLEDtrueEnable email/password login & signup.
ST_AUTH_BREAK_GLASS_LOCAL_ENABLEDfalseEmergency local instance_admin login when local auth is otherwise off.
ST_AUTH_SIGNUP_MODEdisabledenabled, disabled, or invite_only.
ST_AUTH_ALLOWED_EMAIL_DOMAINS(empty)Comma-separated allow-list; empty = allow all.
ST_AUTH_ACCESS_TOKEN_TTL15mAccess-token lifetime.
ST_AUTH_REFRESH_TOKEN_TTL720hRefresh-token lifetime.
ST_AUTH_COOKIE_SECUREtrueSecure flag on auth cookies (set false only for local HTTP).
ST_AUTH_COOKIE_SAME_SITElaxlax, strict, or none.
ST_AUTH_JWT_ACTIVE_KEY_ID(empty)ID of the active signing key. Required when auth is enabled.
ST_AUTH_JWT_KEYS(empty)JSON array of {id, secret} keys (secret ≥ 32 bytes). Required when auth is enabled.
ST_AUTH_BOOTSTRAP_ADMIN_EMAIL(empty)Create the first admin at startup.
ST_AUTH_BOOTSTRAP_ADMIN_PASSWORD(empty)Password for the bootstrap admin.
ST_AUTH_BOOTSTRAP_ADMIN_DISPLAY_NAME(empty)Display name for the bootstrap admin.

Email / SMTP

VariableDefaultDescription
ST_AUTH_EMAIL_DELIVERYdisableddisabled, log, or smtp.
ST_AUTH_EMAIL_FROM(empty)Sender address (required for smtp).
ST_AUTH_SMTP_HOST(empty)SMTP host (required for smtp).
ST_AUTH_SMTP_PORT587SMTP port.
ST_AUTH_SMTP_USERNAME(empty)SMTP username.
ST_AUTH_SMTP_PASSWORD(empty)SMTP password.
ST_AUTH_SMTP_TLSstarttlsstarttls, tls, or none.

OIDC & provisioning

VariableDefaultDescription
ST_AUTH_OIDC_PROVIDERS_JSON[]JSON array of OIDC providers. See SSO / OIDC.
ST_AUTH_PROVISIONED_TEAMS_JSON[]Teams to create at startup.
ST_AUTH_PROVISIONED_ROLE_MAPPINGS_JSON[]OIDC group → role mappings.
ST_AUTH_STREAM_OWNERSHIP_JSON[]Stream → team ownership assignments.

Message indexer

VariableDefaultDescription
ST_INDEXER_ENABLEDtrueEnable background message indexing.
ST_INDEXER_STREAM_EXCLUDE_*Comma-separated stream-name patterns to skip in addition to automatically excluded WorkQueuePolicy streams. Review InterestPolicy retention before indexing.
ST_INDEXER_RETENTION_HOURS168Reserved configuration. Automatic cleanup of indexed rows is not implemented; size and back up the database accordingly.
ST_INDEXER_BATCH_SIZE100Messages per batch (1–10000).
ST_INDEXER_DISCOVERY_INTERVAL_MS60000New-stream discovery interval.
ST_INDEXER_IDLE_POLL_START_MS2000Initial idle poll interval.
ST_INDEXER_IDLE_POLL_MAX_MS30000Max idle poll interval.
ST_INDEXER_MAX_CONCURRENT_STREAMS4Streams indexed in parallel (1–256).
ST_INDEXER_LEASE_DURATION_MS30000Coordination lease TTL.
ST_INDEXER_MAX_BATCHES_PER_RUN10Batches per discovery cycle.

Off by default. See Searching messages.

VariableDefaultDescription
ST_PAYLOAD_INDEXING_ENABLEDfalseEnable full-text / JSON path scalar search.
ST_PAYLOAD_INDEX_MAX_BYTES32768Max payload size to index.
ST_PAYLOAD_INDEX_MAX_JSON_BYTES32768Max JSON bytes indexed.
ST_PAYLOAD_INDEX_MAX_JSON_DEPTH12Max JSON nesting depth.
ST_PAYLOAD_INDEX_MAX_JSON_SCALARS512Max scalar values extracted per message.
ST_PAYLOAD_INDEX_MAX_JSON_PATH_LENGTH512Max indexed JSON path length.
ST_PAYLOAD_INDEX_MAX_SCALAR_TEXT_BYTES1024Max bytes per indexed scalar.
ST_PAYLOAD_INDEX_STREAM_EXCLUDE(empty)Stream patterns to exclude from payload indexing.
ST_PAYLOAD_INDEX_QUERY_MAX_LENGTH512Max payload query length.

Dead letter queue

VariableDefaultDescription
ST_DLQ_ADVISORY_STREAMSTREAM_TRACE_DLQName of the advisory capture stream.
ST_DLQ_ADVISORY_STREAM_AUTO_CREATEfalseLet Stream Trace create the advisory stream if missing.

See Dead letter queue.

Traces

VariableDefaultDescription
ST_TRACE_ID_HEADERSNats-Trace-Id,X-Trace-IdMessage headers to read trace IDs from.
ST_TRACE_OBSERVATION_RETENTION_MS604800000 (7d)Trace observation retention.

Throughput sampling

VariableDefaultDescription
ST_THROUGHPUT_SAMPLE_INTERVAL_MS30000Sampling interval.
ST_THROUGHPUT_SAMPLE_RETENTION_MS1209600000 (14d)Sample retention.
ST_THROUGHPUT_LEASE_DURATION_MS60000Collector lease TTL.
ST_THROUGHPUT_MAX_CONCURRENT_STREAMS4Streams sampled in parallel.
ST_THROUGHPUT_TREND_TOLERANCE_PERCENT10Trend-change tolerance.

Consumer backlog signals

VariableDefaultDescription
ST_CONSUMER_BACKLOG_PENDING_THRESHOLD5Pending count that flags a backlog signal.
ST_CONSUMER_BACKLOG_STALE_AFTER_MS60000Age after which a backlog is considered stale.