Override ConfigMap to Modify the Storage Retention Period in Workspace Grafana Loki
DKP configures Grafana Loki to retain log metadata and logs for 1 week, using the Compactor. This retention policy can be customized.
The minimum retention period is 24h.
To customize the retention policy using configOverrides, run these commands on the management cluster:
Execute the following command to get the namespace of your workspace:
CODEdkp get workspacesCopy the value under the
NAMESPACEcolumn for your workspace.Set the
WORKSPACE_NAMESPACEvariable to the namespace copied in the previous step:CODEexport WORKSPACE_NAMESPACE=<WORKSPACE_NAMESPACE>Create a
ConfigMapwith custom configuration values for Grafana Loki. Since the retention configuration is nested in aconfigstring, you must copy the entire block. The following example sets the retention period to 360 hours (15 days). Refer to Grafana Loki’s Retention Configuration documentation for more information about this field.CODEcat <<EOF | kubectl apply -f - apiVersion: v1 kind: ConfigMap metadata: name: grafana-loki-custom-overrides namespace: ${WORKSPACE_NAMESPACE} data: values.yaml: | loki: structuredConfig: limits_config: retention_period: 360h EOFEdit the
grafana-lokiAppDeployment to set the value ofspec.configOverrides.nametografana-loki-custom-overrides(Refer to Deploy a service with a custom configuration for more information).CODEdkp edit appdeployment -n ${WORKSPACE_NAMESPACE} grafana-lokiAfter your editing is complete, the AppDeployment resembles this example:
CODEapiVersion: apps.kommander.d2iq.io/v1alpha3 kind: AppDeployment metadata: name: grafana-loki namespace: ${WORKSPACE_NAMESPACE} spec: appRef: name: grafana-loki-0.69.10 kind: ClusterApp configOverrides: name: grafana-loki-custom-overrides