Skip to content

Modify Workspace Data Retention Policy



POST /api/v1/workspace/modify_rp_duration

Overview

Adjust the standard retention periods for each category in the current workspace and the supported long-term storage policies.

Prerequisites and Usage Steps

  1. Use a Key for the current workspace with the workspace.ilmManage permission to read the version, billing state, storage type, index mode, and existing policies from Current Workspace.
  2. Select standard/long-term retention periods based on the categories supported by the current version and engine, and submit only the fields changed in this request.
  3. Verify the actual change summary returned, then read back the configuration and check whether storage has taken effect. Downstream failures may occur after saving; do not repeatedly overwrite configuration as a substitute for synchronized troubleshooting.

Requires the workspace.ilmManage permission. First read versionType, billingState, durationSet, storagePolicy, esIndexMerged, and datastore from the current workspace details to confirm the range allowed for the current site, and then submit the categories to be changed. Operations are not allowed for free/freeEdition; arrearage/expired states are rejected. Shortening a retention period affects the historical range that can be queried subsequently and does not mean that cleaned data can be restored.

Fields are filtered by the actual index mode: merged mode uses apm, split mode uses tracing/rum/profiling/security; fields not applicable to the mode may be ignored rather than raising an error. You must check the returned change summary and read back. lineage is only for Doris/ScopeDB and has only a standard period; this page does not support session_replay and does not return fields from other entry points.

Standard retention periods are validated against the current workspace version: operations are not allowed for free/freeEdition; pay selects from the discrete tiers listed for each field below; the enterprise code default is 1d–1800d for each category; the unlimited code default is 1d–3600d for metrics rp and 1d–1800d for the remaining categories. These are the allowed ranges for the update API, not the default saved durations, and console-recommended tiers should not be treated as all allowed values; sites can override these ranges, and administrators must confirm the actual configuration. The total long-term duration is validated separately and cannot reuse the standard period range.

The total long-term duration must be greater than the standard period. Logs are supported only for scopedb and pay/enterprise/unlimited; metrics for pay and unlimited with Billing Center enabled require metric_point_total, while other versions also reject explicit timeseries; unlimited allows only rp/logging long-term types. Before changing the standard period, proactively confirm that the old long-term period is still greater than the new standard period; the server retains compatibility for some historical policies, so when storagePolicy is not passed, success alone cannot prove that the two configurations are reasonable. Omitted policy categories are retained; submitting a category {} or omitting longStorageEnabled is normalized as disabled.

Database and metrics/logs/lineage downstream updates are performed in steps, and errors may occur after the database commit; some non-guancedb metrics notifications are fault-tolerant, and HTTP success does not prove that all downstream updates have been applied. After read-back confirmation, handle only incomplete synchronization; a lineage failure may enter compensation notification, so do not blindly modify repeatedly. A successful content lists only actual changes; if there are no changes, it may be {}; do not infer from an empty summary that all submitted fields have taken effect.

Request Headers

Parameter Name Type Required Description
DF-API-KEY string Y OpenAPI authentication credential for the workspace.
Example: <DF-API-KEY>
How to obtain or fill in: Obtain an OpenAPI Key with the required operation permission from API Key Management in the target workspace.

Body Request Parameters

Parameter Name Type Required Description
storagePolicy.rp json Metrics policy object. Omitting the category/using null for the category does not change it; a category {} is normalized as disabled and may disable an existing long-term policy. To retain it, omit the entire category object.
Example: {"longStorageEnabled": false}
How to obtain or fill in: Read the complete configuration from the current storagePolicy.rp.
storagePolicy.rp.longStorageEnabled boolean Optional recommended JSON boolean; when the category object is present, omission defaults to false; lineage can only be false/omitted, otherwise it is rejected.
Example: false
How to obtain or fill in: Select true if long-term retention is required, or false to explicitly disable it.
storagePolicy.rp.longStorageDuration string Required when enabled; when disabled, normalized to an empty string. For pay, metrics default to 90d/120d/180d/360d/540d/720d and logs default to 90d/120d/180d/360d; for enterprise/unlimited, logs default to 1d–1800d and metrics to 1d–3600d, and sites can override these values. For lineage, only empty/omitted is allowed.
Example: 180d
How to obtain or fill in: Select from the long-term tiers allowed for the site and ensure it is greater than the standard period.
storagePolicy.logging json Logs policy object. Omitting the category/using null for the category does not change it; a category {} is normalized as disabled and may disable an existing long-term policy. To retain it, omit the entire category object.
Example: {"longStorageEnabled": false}
How to obtain or fill in: Read the complete configuration from the current storagePolicy.logging.
storagePolicy.logging.longStorageEnabled boolean Optional recommended JSON boolean; when the category object is present, omission defaults to false; lineage can only be false/omitted, otherwise it is rejected.
Example: false
How to obtain or fill in: Select true if long-term retention is required, or false to explicitly disable it.
storagePolicy.logging.longStorageDuration string Required when enabled; when disabled, normalized to an empty string. For pay, metrics default to 90d/120d/180d/360d/540d/720d and logs default to 90d/120d/180d/360d; for enterprise/unlimited, logs default to 1d–1800d and metrics to 1d–3600d, and sites can override these values. For lineage, only empty/omitted is allowed.
Example: 180d
How to obtain or fill in: Select from the long-term tiers allowed for the site and ensure it is greater than the standard period.
storagePolicy.lineage json Data observability policy object. Omitting the category/using null for the category does not change it; a category {} is normalized as disabled and may disable an existing long-term policy. To retain it, omit the entire category object.
Example: {"longStorageEnabled": false}
How to obtain or fill in: Read the complete configuration from the current storagePolicy.lineage.
storagePolicy.lineage.longStorageEnabled boolean Optional recommended JSON boolean; when the category object is present, omission defaults to false; lineage can only be false/omitted, otherwise it is rejected.
Example: false
How to obtain or fill in: For lineage, enter only false or omit it; long-term retention is not supported.
storagePolicy.lineage.longStorageDuration string Required when enabled; when disabled, normalized to an empty string. For pay, metrics default to 90d/120d/180d/360d/540d/720d and logs default to 90d/120d/180d/360d; for enterprise/unlimited, logs default to 1d–1800d and metrics to 1d–3600d, and sites can override these values. For lineage, only empty/omitted is allowed.
Example:
How to obtain or fill in: For lineage, enter only an empty string or omit it, and do not select a long-term tier.
lineage string Standard retention period for data observability. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 3d/7d/14d/30d/60d/90d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d). Available only when the actual lineage is Doris/ScopeDB, and long-term storage is not configured.
Null allowed: False
Example: 3d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.lineage, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
rp string Standard retention period for metrics time series. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 3d/7d/14d/30d/60d/90d/180d/360d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–3600d).
Null allowed: False
Example: 3d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.rp, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
logging string Standard retention period for default logs. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 3d/7d/14d/30d/60d/90d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d).
Null allowed: False
Example: 3d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.logging, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
dialtest string Standard retention period for synthetic tests. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 3d/7d/14d/30d/60d/90d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d).
Null allowed: False
Example: 3d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.dialtest, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
backup_log string Standard retention period for backup logs. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 180d/360d/720d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d).
Null allowed: False
Example: 180d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.backup_log, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
security string Standard retention period for security data. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 90d/180d/360d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d). Takes effect only in split index mode and may be ignored in merged mode.
Null allowed: False
Example: 90d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.security, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
keyevent string Standard retention period for events. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 14d/30d/60d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d).
Null allowed: False
Example: 14d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.keyevent, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
tracing string Standard retention period for application traces. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 3d/7d/14d/30d/60d/90d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d). Takes effect only in split index mode and may be ignored in merged mode.
Null allowed: False
Example: 3d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.tracing, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
profiling string Standard retention period for Profiling. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 3d/7d/14d/30d/60d/90d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d). Takes effect only in split index mode and may be ignored in merged mode.
Null allowed: False
Example: 3d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.profiling, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
rum string Standard retention period for Real User Monitoring (RUM). Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 3d/7d/14d/30d/60d/90d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d). Takes effect only in split index mode and may be ignored in merged mode.
Null allowed: False
Example: 3d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.rum, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
apm string Standard retention period for application performance with merged indexes. Optional; if omitted, it is retained; null is not allowed. Lowercase days with d; for pay, the code default options are 3d/7d/14d/30d/60d/90d; for enterprise/unlimited, the allowed range is subject to the site (unlimited code defaults to 1d–1800d). Takes effect only in merged index mode and may be ignored in split mode.
Null allowed: False
Example: 3d
How to obtain or fill in: Read the current value from Current Workspace content.durationSet.apm, esIndexMerged, and datastore, and select according to the tiers allowed for the current version/engine.
storagePolicy json Optional object. Only submitted categories are merged; omitting it/{} retains existing policies; null is not allowed. The long-term duration is the total retention duration, not added to the standard duration, and when enabled it must be strictly greater than the corresponding standard period in this request. Only rp/logging listed in this document are used to enable long-term retention; lineage is only compatible with disabling.
Null allowed: False
Example: {"rp": {"longStorageEnabled": true, "longStorageDuration": "180d"}}
How to obtain or fill in: Read the complete policy for the target category from Current Workspace content.storagePolicy.

Additional Parameter Notes

Only storage categories supported by the current workspace mode are updated. The standard period is durationSet; the long-term period is the total retention duration and cannot be simply added to the standard period.

Request Example

curl --request POST 'https://openapi.guance.com/api/v1/workspace/modify_rp_duration' \
  -H 'DF-API-KEY: <DF-API-KEY>' \
  -H 'Content-Type: application/json' \
  --data-raw '{"logging":"14d"}'

Response

HTTP 200, application/json. The example below shows the main fields that can be read directly.

Field Type Description
content object Contains only a summary of data types that changed; if nothing changed, it may be {}; the complete durationSet is not always returned.
content. object For example, rp/logging/lineage, for each category that actually changed.
content..old string or null Original standard retention period; present only when the standard period changes.
content..new string New standard retention period; present only when the standard period changes.
content..oldStoragePolicy object Original long-term policy; present only when the policy changes; may be {} if not configured.
content..oldStoragePolicy.longStorageEnabled boolean Original long-term retention switch; may be omitted.
content..oldStoragePolicy.longStorageDuration string Original total long-term duration; may be empty/omitted.
content..newStoragePolicy object New long-term policy; present only when it changes; a neutral lineage policy may be {}.
content..newStoragePolicy.longStorageEnabled boolean New long-term retention switch.
content..newStoragePolicy.longStorageDuration string New total long-term duration; empty when disabled.
content.declaration object or null A non-empty change object adds a common declaration; when content={}, it is not inserted.
{
  "code": 200,
  "content": {
    "logging": {
      "old": "7d",
      "new": "14d"
    },
    "declaration": {}
  },
  "errorCode": "",
  "message": "",
  "success": true,
  "traceId": "TRACE-EXAMPLE"
}

Error Responses

For authentication, rate limiting, and common request errors, see Common Error Definitions.

Billing Center connection or request exceptions return HTTP 400, ft.CloudCareApiError by default; explicit upstream business responses are returned according to the actual mapped status code. Only mapped status codes ≥500 or other unhandled exceptions are globally normalized to 500 ft.InternalServerError. First read back the retention period and long-term policy, then check the actual storage and billing query results; do not blindly overwrite repeatedly.

HTTP Status errorCode Trigger Condition Message or Response Description Handling Method
406 ft.ParameterValidationFailed Request field is missing, or the field value violates the declared validation conditions Parameter parsing failed Check the parameter location, field name, type, and value.
400 ft.RequestJsonFormatError Request JSON syntax is invalid Request JSON format error Correct the JSON according to content.reason, line, and column.
400 ft.JsonFormatError The JSON top level is not an object Some JSON file format error Submit a JSON object according to the parameters on this page.
400 ft.FreeWKSPLimit Current workspace version is free/freeEdition Invalid operation; the current workspace is on the Free Plan Upgrade to a version that supports retention policy editing before performing the operation.
400 ft.WKSPStatusAbnormal Workspace billingState is arrearage/expired The workspace is in arrears or has expired Resolve the billing/expiration state first.
406 ft.CurrentVersionUnsupportRp Unsupported editing version or the current site lacks the corresponding tier The current version does not support rp:{} The administrator should verify the version and configuration.
400 ft.IllegalDataKeepTime Invalid pay standard period, or invalid new lineage standard period Invalid data retention period Select a duration allowed for the current site and verify lowercase days with d.
406 ft.InvalidDuration Invalid standard/long-term format or invalid fixed long-term tier Invalid duration Use a positive integer number of days followed by d and a tier allowed for the current version.
406 ft.InvalidDurationRange Custom standard or long-term range is invalid, or the long-term period is not greater than the standard period Exceeds the valid data retention period range Verify the version range; the long-term period must be strictly greater than the standard period.
400 ft.JsonFormatError storagePolicy or the category policy is not an object Some JSON file format error Use the policy object structure on this page.
400 ft.InvalidActionForbiddenChange The version/engine/metrics billing type does not support the long-term policy Changing the index merge status switch is prohibited Confirm the log scopedb and metrics billing type before enabling.
404 ft.NamespaceDatastoreNotFound Lineage is requested but the current workspace has no valid Doris/ScopeDB lineage engine Storage type for {} not found Confirm that the actual data engine is supported.
404 ft.ForbiddenIndexCfg Lineage submits a non-neutral long-term policy Index configuration for sls/beaver storage types is not supported Lineage uses only the standard retention period and does not enable long-term retention.
429 ft.OperationTooFrequently Storage mutex is busy or the lock is lost during execution Your operation is too frequent; please try again later Back off, read back the retention period and actual synchronization status before proceeding, and do not overwrite concurrently.
500 ft.InternalServerError Database, cache/queue, mapped status code ≥500 downstream errors, or other unhandled exceptions; writes may already be committed on failure Internal error First read back the retention period and long-term policy, then check the actual storage and billing query results; do not blindly overwrite repeatedly. Preserve traceId.
400 ft.CloudCareApiError Billing Center connection, timeout, or request exception; business errors may also be returned according to the upstream mapped status code Billing Center API error; the specific message is returned according to the exception or upstream prompt. First read back the retention period and long-term policy, then check the actual storage and billing query results; do not blindly overwrite repeatedly. Preserve traceId and ask the administrator to check the Billing Center connection and processing result.
406 ft.InvalidBossNode Enabling long-term metrics retention requires querying the Billing Center billing plan, but the brand/Billing Center node is not configured Invalid Boss node Ask the administrator to verify the brand and Billing Center node; read back the current retention period and storage policy before deciding whether to retry.

Feedback

Is this page helpful?