How to Set the Retention Time of Cold Data for a Project

Use project labels to override the platform-default retention for logs that belong to a specific project.

Project overrides currently apply to the ClickHouse storage backend with hot / cold tiering enabled. Behavior on OpenSearch is limited (see the note at the end).

Before You Begin

Confirm the target storage cluster:

  1. Uses Alauda Container Platform Log Storage Management with PlatformLogForward.spec.externalStorage.type: clickhouse.
  2. Has hot / cold tiering enabled on PlatformLogForward; see How to Use S3 Storage with ClickHouse.
  3. Is queried by the account you plan to use to edit the target project on the global cluster.

About Project-Level Retention Settings

Project labels override the PLF-level ttl (hot) and coldTTL (cold) values for records tagged with that project's name.

Use the following labels on the Project resource:

LabelDescription
cpaas.io/project.hotDataRetentionDaysRetention time of hot data kept in active ClickHouse storage, in days.
cpaas.io/project.coldDataRetentionDaysRetention time of cold data after it is transferred to S3 cold storage, in days. Set to 0 to keep indefinitely.
cpaas.io/project.logPolicyEnabledEnables the project-level log policy. Set to true.

Legacy labels still exist in some environments (cpaas.io/project.esIndicesKeepDays, cpaas.io/project.esPolicyEnabled), but new configurations should use the labels above.

Edit the Project Resource

  1. Log in to the global cluster.

  2. Open the target project resource:

    kubectl edit project <project-name>
  3. Add or update the following labels:

    apiVersion: auth.alauda.io/v1
    kind: Project
    metadata:
      name: bookinfo
      labels:
        cpaas.io/project.hotDataRetentionDays: '7'
        cpaas.io/project.coldDataRetentionDays: '30'
        cpaas.io/project.logPolicyEnabled: 'true'

The change reaches the storage cluster within a minute through the platform's cross-cluster policy sync.

Label Behavior

  • cpaas.io/project.hotDataRetentionDays Controls how long the project's hot data remains in active ClickHouse storage before it is moved (with tiering enabled) or deleted (with tiering disabled).
  • cpaas.io/project.coldDataRetentionDays Controls how long the project's cold data is retained after it has been transferred to S3.
  • cpaas.io/project.logPolicyEnabled Must be set to true for the project-level retention policy to take effect.

Version Notes

  • ACP 4.2 environments may have old and new labels coexisting for compatibility.
  • ACP 4.3 and later, including ACP 4.4, use the new labels as the source of truth.
  • If your environment still contains legacy labels such as cpaas.io/project.esIndicesKeepDays or cpaas.io/project.esPolicyEnabled, prefer the new labels for new configurations.
Project-level retention does not take effect on OpenSearch

On the OpenSearch storage backend the project-scoped labels above do not currently take effect. The operator skips writing log-policy-config on the OS backend, and the razor-api cron that reconciles the ISM policy only reads the policy, never writes it. As a result:

  • cpaas.io/project.hotDataRetentionDays — no effect.
  • cpaas.io/project.coldDataRetentionDays — no effect (OpenSearch tiered storage is provisioned outside the platform anyway).
  • cpaas.io/project.logPolicyEnabled — no effect.

Every project on an OpenSearch storage cluster keeps the platform-default retention. If per-project retention is a compliance requirement, choose the ClickHouse backend, or apply your own ISM policies directly against the OpenSearch cluster.

See Log Component Selection Guide — Known OpenSearch backend limitations for the full list of OS-specific caveats.