monitoring.retention-policy.put

Set how many days metrics and logs are kept

PUT /monitoring/api/retention-policyIAM monitoring:PutRetentionPolicyChanges stateDestructive

Only the fields sent change. Metrics 14–90 days, logs 1–30 days; longer retention is a paid option, not available yet. Lowering a limit deletes the data past it at the next daily sweep (03:20 UTC); there is no undo after that. Logs are kept by whole UTC days: 1 day keeps today and yesterday.

Request syntax

PUT /monitoring/api/retention-policy
{
  "metricsRetentionDays": "number",
  "logsRetentionDays": "number"
}

Request body

  • metricsRetentionDaysOptional

    number

    Days of built-in metrics, 14–90 (default 90); unchanged when omitted

    Constraints: integer

  • logsRetentionDaysOptional

    number

    Days of logs, 1–30 (default 30); unchanged when omitted

    Constraints: integer

Response

200 with the policy as get returns it, plus warning: what the next daily sweep will delete when a limit was lowered (null otherwise). 400 for a value outside the limits.

A JSON response is wrapped as { "success": true, "data": … }; the CLI prints the whole body with --json.

Errors

  • 400The request does not pass the schema above. The body is { "error": …, "issues": […] }, one issue per field.
  • 401No credentials, or an access key that is unknown, revoked or expired.
  • 403The caller's policies do not allow monitoring:PutRetentionPolicy on this resource. The body names the action and the resource, and the refusal is recorded in the audit log.
  • 404The resource does not exist in your organization.

Examples

The required parameters only, with example values. Replace id and the other placeholders with your own.

dcloud monitoring retention-policy put

Generated from the API description, the same one the API checks requests against and the CLI is built from. MCP tool: dcloud_monitoring_retention-policy_put.