Documentation

Export to Cloudflare R2

Gzip NDJSON files in your R2 bucket, one per batch, with no egress fees to read them back.

What ModelRiver writes

R2 speaks the S3 API, so ModelRiver writes the same files as on Amazon S3: one gzip-compressed NDJSON object per batch (one event per line):

TEXT
1<prefix>/<yyyy>/<mm>/<dd>/<first-event-id>_<last-event-id>.ndjson.gz

The date is the first event's date in UTC. A retried batch is written to the same key, so the bucket never holds the same event twice. Send test writes <prefix>/_modelriver_test.json.

Objects are private: ModelRiver sets no ACL and no public cache headers. Keep the bucket's public access (r2.dev subdomain and custom domains) off.

1. Create a bucket and an API token

In the Cloudflare dashboard, open R2 Object Storage and create a bucket that only holds audit logs, for example acme-audit-logs. Choose the EU jurisdiction if the logs must stay in the EU.

Then create an API token for ModelRiver under R2 Object Storage → Manage API tokens → Create API token:

SettingValue
PermissionsObject Read & Write
Specify bucket(s)Apply to specific buckets only, and pick the audit log bucket
TTLOptional. When the token expires, the export pauses until you enter a new one.

Cloudflare shows an Access Key ID and a Secret Access Key once. Copy both; ModelRiver needs them, not the token value.

R2 tokens can't be limited to writing or to a prefix the way an AWS IAM policy can: Object Read & Write also allows reading, listing and deleting in that bucket. That's why the bucket should hold nothing but audit logs, and why your SIEM should get its own read-only token rather than ModelRiver's.

2. Find your account ID

The account ID is a 32-character hex string. It's shown in the Cloudflare dashboard under R2 Object Storage → Account details, and it's the first part of the bucket's S3 API URL (https://<ACCOUNT_ID>.r2.cloudflarestorage.com/<bucket>). You can paste that whole URL into the form; ModelRiver keeps only the account ID.

3. Configure the export

In Organization settings → Audit log export, choose Cloudflare R2 and fill in:

FieldValue
Account IDThe ID from step 2.
JurisdictionDefault, or European Union (EU) for a bucket created in the EU jurisdiction.
Bucketacme-audit-logs
Key prefixmodelriver/audit (optional)
Access key ID, Secret access keyThe token's Access Key ID and Secret Access Key.

ModelRiver builds the endpoint from these (https://<ACCOUNT_ID>.r2.cloudflarestorage.com, or .eu.r2.cloudflarestorage.com for the EU), uses region auto and path-style URLs (<endpoint>/<bucket>/<key>). Under the hood it's an S3 destination, so an S3-compatible client sees the same requests.

The access key is encrypted at rest and never shown again. The page shows only its last four characters. You can change the bucket, account or jurisdiction later without entering it again.

Choose Send test, then check that modelriver/audit/_modelriver_test.json appeared in the bucket. If R2 refuses, the error names R2's code and highlights the field to fix.

Reading the files

Any S3 client works with R2's endpoint and region auto. With the AWS CLI and a read-only R2 token (untested):

Bash
aws s3 cp s3://acme-audit-logs/modelriver/audit/2026/11/25/ . --recursive \
--endpoint-url https://<ACCOUNT_ID>.r2.cloudflarestorage.com --region auto
zcat *.ndjson.gz | jq -c 'select(.high_risk)'

SIEM inputs that read S3-compatible storage can read the bucket the same way, with their own read-only token. R2 charges no egress fees, so reading the files back costs only R2's per-request operations.