Skip to content

LogsRetentionFlag

Source: src/Cloudflare/LogsControl/RetentionFlag.ts

The zone-level Logpull retention flag (/zones/{zone_id}/logs/control/retention/flag) pinned to a desired value.

The flag is a singleton that always exists on every zone, so this resource never creates or deletes anything physical. Reconcile re-posts the flag when the observed value differs from the desired one; destroy restores the value the flag had before Alchemy first managed it (captured as initialFlag) — there is no DELETE endpoint.

Logpull is an Enterprise feature — on unentitled zones every operation fails with the typed LogsControlNotAuthorized error.

Enable Logpull retention on a zone

const retention = yield* Cloudflare.LogsRetentionFlag("Retention", {
zoneId: zone.zoneId,
flag: true,
});

Explicitly disable retention

yield* Cloudflare.LogsRetentionFlag("Retention", {
zoneId: zone.zoneId,
flag: false,
});