How to Set the Default Log Retention Time
Platform-default retention controls how long each log category stays in ClickHouse before it is deleted. Values are set on the PlatformLogForward resource and apply to every project that doesn't declare its own override.
For per-project overrides, see How to Set the Retention Time of Cold Data for a Project.
TOC
Before You BeginAbout the FieldEdit the PlatformLogForward ResourceHow Changes Take EffectProject-Level OverrideHot + Cold Tiering (Optional)Migrating from the Legacy chartRelated TopicsBefore You Begin
Confirm the target storage cluster:
- Uses Alauda Container Platform Log Storage Management with
PlatformLogForward.spec.externalStorage.type: clickhouse(OpenSearch is covered at the end of this page). - Has
PlatformLogForwardnamedplatform-defaultalready provisioned. - Is accessed by an account that can edit
platformlogforwards.log.alauda.io.
About the Field
Retention lives at spec.clickhouse.ttl.* on the PlatformLogForward resource. One field per log category, unit days, 0 = keep forever.
0 means never delete, so a fresh install retains everything until an explicit retention is set. Pick values that match your disk budget and compliance window.
Edit the PlatformLogForward Resource
-
Log in to the storage cluster (the cluster that hosts ClickHouse).
-
Open the
PlatformLogForwardresource: -
Set or update
spec.clickhouse.ttl:
Save and exit. No pod restart is needed.
How Changes Take Effect
- The log-storage operator reconciles
platform-defaultand regenerates theaiops-logging-ttl-configConfigMap. - The
razordeployment reads the new ConfigMap on its next sync cycle (within a minute). razorrunsALTER TABLE <table> MODIFY TTL toDateTime(time) + INTERVAL <N> DAY DELETEagainst each log table on ClickHouse.- ClickHouse applies the TTL to existing data on its next merge; rows older than the new retention are removed automatically.
The whole cycle completes well under five minutes on a healthy cluster.
Project-Level Override
Platform-default retention is the fallback for every project. Any project that needs a different value takes precedence via project labels; see How to Set the Retention Time of Cold Data for a Project. Project labels only override audit, event, workload-related, and system-related data for that project — categories not listed in the project label fall back to the platform default.
Hot + Cold Tiering (Optional)
If hot / cold tiering is enabled, spec.clickhouse.ttl.* controls hot retention; set spec.clickhouse.coldTTL.* to move expired data to the cold volume instead of deleting it. See How to Use S3 Storage with ClickHouse for the tiered-policy setup. Without tiering, ttl is a hard delete.
Migrating from the Legacy chart
Clusters that were installed from the v4.3 era chart-alauda-log-clickhouse carried retention under values.logging.ttl.*. v4.4 Log Storage Management moves this field to PlatformLogForward 1:1
(same field names, same unit, same semantics). Upgraded clusters have the values auto-propagated by the operator's derive-plf step; verify with:
If the output is empty after an upgrade, re-apply the values from the previous chart values.yaml.
On the OpenSearch backend, retention is controlled by Index State Management (ISM) policies, not by spec.clickhouse.ttl. The razor-api component ships default ISM policies and the operator applies them against the OpenSearch cluster at install time. To change OpenSearch retention, modify the ISM policies directly on the OpenSearch cluster. spec.clickhouse.ttl is ignored on OpenSearch deployments; the clickhouse sub-object only applies when spec.externalStorage.type: clickhouse.
Related Topics
- How to Set the Retention Time of Cold Data for a Project — per-project override of these defaults.
- How to Use S3 Storage with ClickHouse — enable hot / cold tiering so
coldTTLbecomes meaningful. - Installation — PLF provisioning flow.