Set CloudWatch log group retention
Sets the retention period on a CloudWatch log group. The update is asynchronous: the statement returns a progress event immediately, and the change completes in the background. Confirm completion by polling the request token from the result.
Query
UPDATE awscc.logs.log_groups
SET PatchDocument = string('[{"op":"replace","path":"/RetentionInDays","value":{{retention_days}}}]')
WHERE region = '{{region}}'
AND Identifier = '{{log_group_name}}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName;
Alternative
A synchronous single-call form that sets the retention policy directly and returns no progress event:
REPLACE aws.logs.log_groups
SET
logGroupName = '{{log_group_name}}',
retentionInDays = {{retention_days}}
WHERE
region = '{{region}}' --required
AND logGroupName = '{{log_group_name}}' --required;
Notes
The response is a progress event, not the updated resource: OperationStatus is typically IN_PROGRESS with a RequestToken. Poll the token with aws/cloud_control/resource-request-by-token (or scan recent requests with aws/cloud_control/resource-requests-by-status) until OperationStatus is SUCCESS or FAILED. The PatchDocument is an RFC 6902 JSON Patch array against the resource's current state, wrapped in string(...); the same pattern updates any mutable property of any AWS resource exposed through Cloud Control. RetentionInDays accepts only the discrete values CloudWatch Logs supports (1, 3, 5, 7, 14, 30, 60, 90, 120, 150, 180, 365, 400, 545, 731, 1096, 1827, 2192, 2557, 2922, 3288, 3653); other values fail the update.