Skip to main content

Log drains to your own bucket: Cloudflare, Fastly and more

Choose a log drain endpoint by payload format. Vercel, Heroku and Convex each use a dedicated endpoint. Platforms that send plain JSON use /v1/events/json, and Supabase sends OpenTelemetry to the OTLP logs endpoint. Your stream determines where the records are stored.

How it works​

Vercel ──JSON or NDJSON─────▶ /v1/events/vercel ─┐
Heroku ──logplex syslog─────▶ /v1/events/heroku ─┤
Netlify, Auth0, Akamai, ──JSON or NDJSON─────▶ /v1/events/json ─┼─▶ your stream's destination
Cloudflare Logpush, Fastly │
Convex ──JSON array─────────▶ /v1/events/convex ─┤
Supabase ──OTLP/HTTP protobuf─▶ /v1/logs ─┘
  • Each log record becomes one line with signal log. JSON records are kept as sent, Heroku syslog messages are parsed into fields, and Supabase records are OpenTelemetry log records with their resource and scope. Delivery format lists them.
  • A 200 means the records are stored durably and will be delivered at least once. See Delivery semantics.
  • The platform's own retries are not deduplicated: a request retried after a lost response is stored again.

1. Create a stream and a key​

Create an ingestion stream in the dashboard, add a destination, and copy the stream's API key and ID. A key for one stream needs no stream ID in the drain. One stream per platform keeps the record shapes apart in your queries.

2. Add the drain​

Vercel​

Endpoint https://api.send2bucket.com/v1/events/vercel, with the key in an Authorization custom header. Vercel log drains has the setup and queries for Vercel's fields.

Heroku​

heroku drains:add with the key as the Basic auth password in the drain URL. Heroku log drains has the setup and queries for Heroku's app and router lines.

Supabase​

Supabase's OpenTelemetry (OTLP) log drain goes to https://api.send2bucket.com/v1/logs with the key in an Authorization header. Supabase log drains has the setup and queries.

Netlify​

A General HTTP endpoint drain goes to https://api.send2bucket.com/v1/events/json?stream=<stream_id> with Bearer <key> as the authorization header. Netlify log drains has the setup and queries for traffic and function logs.

Auth0​

Auth0 log streams are on paid plans. Create a stream of type Custom Webhook:

  • Payload URL: https://api.send2bucket.com/v1/events/json?stream=<stream_id>
  • Authorization Token: Bearer <key>. Auth0 sends the field as the whole Authorization header.
  • Content Format: JSON Lines, JSON Array or JSON Object; all three work.

Akamai DataStream 2​

Add a custom HTTPS destination to the stream, with the JSON log format:

  • Endpoint URL: https://api.send2bucket.com/v1/events/json?stream=<stream_id>
  • Authentication: Basic, any username, the API key as the password. Akamai does not let a custom header set Authorization.

Akamai checks the destination by posting {"access_validation":true}; Send2Bucket answers it and stores nothing.

Cloudflare Logpush​

Logpush to an HTTP destination is set up through the API. Headers go in the destination URL as header_ parameters:

curl https://api.cloudflare.com/client/v4/zones/<zone_id>/logpush/jobs \
-H "Authorization: Bearer <cloudflare_api_token>" \
-H "Content-Type: application/json" \
--data '{
"name": "send2bucket",
"dataset": "http_requests",
"destination_conf": "https://api.send2bucket.com/v1/events/json?header_Authorization=Bearer%20<key>&header_S2b-Stream=<stream_id>",
"max_upload_bytes": 5000000
}'

Logpush gzips its uploads; Send2Bucket decompresses them, with or without a Content-Encoding header, and drops the {"content":"tests"} upload Cloudflare sends to check the destination. 5 MB is the smallest max_upload_bytes; Cloudflare does not say whether it counts it before or after compression, so watch for 413 errors on busy zones. Workers Logpush works the same way with the workers_trace_events dataset.

Fastly​

Add an HTTPS logging endpoint to the service:

  • URL: https://api.send2bucket.com/v1/events/json?stream=<stream_id>
  • Custom header name Authorization, value Bearer <key>
  • JSON log entry format: Array of JSON or Newline delimited, with a JSON log line format such as {"host":"%{req.http.host}V","url":"%{json.escape(req.url)}V","status":%{resp.status}V}
  • Maximum bytes: under 8 MiB

Fastly checks that the host accepts its logs at /.well-known/fastly/logging/challenge before streaming; Send2Bucket answers for every service.

Convex​

Convex log streams are on the Pro plan. Add a Webhook log stream; Convex takes only a URL, so the key goes in it:

https://api.send2bucket.com/v1/events/convex?api-key=<key>&stream=<stream_id>

Convex sends a verification event when you save the stream; Send2Bucket answers it and stores nothing. The x-webhook-signature header is not checked.

For AWS and Google Cloud logs, see CloudWatch Logs through Firehose and Cloud Logging through Pub/Sub.

3. Check the endpoint​

Before the platform sends anything, check the key and stream with one request. It stores one record, and the answer is a 200 with an empty body:

curl -i https://api.send2bucket.com/v1/events/vercel \
-H "Authorization: Bearer $S2B_API_KEY" \
-H "S2b-Stream: <stream_id>" \
--data-binary '{"id":"check","level":"info","message":"hello from curl"}'

A 401 means the key is wrong or revoked; a 403 or 400 names the stream problem; a 409 means the stream has no destination. The API reference lists every error.

4. Query the logs​

DuckDB reads the objects in place. This view keeps the drained logs; the stream column comes from the object path:

INSTALL httpfs; LOAD httpfs;
CREATE SECRET s2b (TYPE s3, PROVIDER credential_chain, REGION '<region>');

CREATE VIEW drains AS
SELECT * FROM read_json(
's3://<bucket>/<prefix>/s2b/stream=*/date=*/hour=*/*.ndjson.gz',
format = 'newline_delimited',
hive_partitioning = true,
columns = {v: 'INTEGER', delivery_batch_id: 'VARCHAR', batch_id: 'VARCHAR',
received_at: 'TIMESTAMPTZ', signal: 'VARCHAR',
resource: 'JSON', scope: 'JSON', data: 'JSON'})
WHERE signal = 'log';

Records per stream and day, with one stream per platform:

SELECT stream, date, count(*) AS records
FROM drains
GROUP BY ALL
ORDER BY date DESC, records DESC;

The Vercel, Heroku, Supabase and Netlify guides have queries for each platform's fields.

In an Iceberg or DuckLake table, the same line is in the payload column with signal_type log; see Table columns.

Notes​

  • Size: records have no size limit of their own. A request can be up to 8 MiB decompressed; Vercel sends up to 1 MB per request. Set a smaller batch size where the platform has one.
  • Billing: each record's JSON as stored is the number billed, so a Heroku line costs its parsed JSON, not its syslog text.
  • Retries: see Retries. To drop repeats, key on the record's own ID, such as Vercel's id, in your query.
  • Keys in URLs: a key in the URL can end up in the platform's logs. Use a header where the platform offers one, and a key for one stream. See Drain keys and streams.