Sentry SDK intake into your own bucket
Change one DSN and every error, transaction, span and log a Sentry SDK sends becomes a JSON line in your bucket or table, ready for SQL.
one dsn, any sentry sdk
Set it wherever the SDK takes its DSN. A DSN ships inside browser apps, so give it a key that writes only to this stream.
https://<key>@api.send2bucket.com/v1/events/sentry/<stream_id>/1
│ │ │ └─ project ID, ignored
│ │ └─ stream ID, optional for a key with one stream
│ └─ the Sentry intake
└─ API key, used as the DSN's public key<key>- API key, used as the DSN's public key
api.send2bucket.com/v1/events/sentry/- the Sentry intake
<stream_id>- stream ID, optional for a key with one stream
1- project ID, ignored
import sentry_sdk sentry_sdk.init( dsn="https://<key>@api.send2bucket.com/v1/events/sentry/1", traces_sample_rate=1.0, enable_logs=True, _experiments={"transport_compression_algo": "gzip"}, )
the same DSN, in any Sentry SDK
Python
sentry_sdk.init(dsn=…)Node.js
Sentry.init({dsn: …})JavaScript in the browser
Sentry.init({dsn: …})
every envelope item, one line
Logs are stored as log, transactions and spans as span, trace metrics as metric, everything else as event.
type- the item type: event, transaction, span, log
envelope- the envelope header: event_id, sent_at, sdk, trace
item- the item header: type, length, content_type
encoding- json for a JSON object, else base64
payload- the item as the SDK sent it
{"v":1,"delivery_batch_id":"dlv_003620i4jcmfsomeheno4l974n9q2","stream_id":"4f1c2b9e-8d3a-4e7b-9c51-0a6f2d8e3b17","batch_id":"bat_003620i4dkhq147n80kko0ds6ceu6","received_at":"2026-11-24T09:23:46.096032Z","signal":"log","data":{"type":"log","envelope":{"sent_at":"2026-11-24T09:23:46.047882Z"},"item":{"item_count":1,"type":"log","content_type":"application/vnd.sentry.items.log+json","length":628},"encoding":"json","payload":{"timestamp":1795512226.0473495,"level":"info","body":"nightly report written","attributes":{"sentry.sdk.name":{"value":"sentry.python.starlette","type":"string"},"sentry.sdk.version":{"value":"3.0.0","type":"string"},"sentry.environment":{"value":"production","type":"string"},"sentry.severity_number":{"value":9,"type":"integer"},"sentry.severity_text":{"value":"info","type":"string"}},"trace_id":"9e3073ac20eb4c30853d38b7d78e8143"}}}- event
- transaction
- span
- log
- otel_log
- attachment
- session
- client_report
- trace_metric
- statsd
- metric_buckets
one envelope, start to finish
A 200 with the event's ID means the items are stored durably and will be delivered at least once. Every reply allows any origin, so browser SDKs need nothing more.
the key is read from the first of
- X-Sentry-Auth, or Authorization: Sentry …
- the sentry_key query parameter browser SDKs send
- the envelope header's dsn
$ curl -i https://api.send2bucket.com/v1/events/sentry/api/1/envelope/ \
-H "X-Sentry-Auth: Sentry sentry_version=7, sentry_key=$S2B_API_KEY" \
--data-binary $'{"event_id":"9ec79c33ec9942ab8353589fcb2e04dc"}\n{"type":"event"}\n{"message":"hello from curl","level":"info"}\n'{"id":"9ec79c33ec9942ab8353589fcb2e04dc"}s3://analytics-raw/raw/s2b/stream=4f1c2b9e-8d3a-4e7b-9c51-0a6f2d8e3b17/date=2026-11-19/hour=03/dlv_01jd3kg8m4.ndjson.gz
{"v":1,"delivery_batch_id":"dlv_01jd3kg8m4","stream_id":"4f1c2b9e-8d3a-4e7b-9c51-0a6f2d8e3b17","batch_id":"bat_01jd3kg6q0","received_at":"2026-11-19T03:04:12.300125Z","signal":"event","data":{"type":"event","envelope":{"event_id":"9ec79c33ec9942ab8353589fcb2e04dc"},"item":{"type":"event"},"encoding":"json","payload":{"message":"hello from curl","level":"info"}}}errors by exception, in sql
DuckDB reads the objects in place. The last exception in values is the one thrown.
SELECT data->>'$.payload.platform' AS platform,
data->>'$.payload.exception.values[#-1].type' AS type,
data->>'$.payload.exception.values[#-1].value' AS message,
count(*) AS events
FROM sentry
WHERE data->>'$.type' = 'event'
GROUP BY ALL
ORDER BY events DESC;| platform | type | message | events |
|---|---|---|---|
| python | ZeroDivisionError | division by zero | 4 |
| node | Error | order not found | 1 |
2 rows
$ curl -i https://api.send2bucket.com/v1/events/sentry/api/1/envelope/
send your first envelope
Create a stream and an API key in the dashboard, add a destination, then set the DSN.
- [ok] errors, transactions, spans, logs, sessions and attachments
- [ok] one JSON line per item, in your bucket or table
- [ok] any Sentry SDK, with one DSN