Persistent volume claim fills quickly due to high log retention

Optimize log retention settings by modifying environment variables to decrease the rate at which the diagnostics service consumes persistent volume claim storage space.

Condition

The diagnostics service storage volume fills up rapidly over brief periods, requiring frequent manual pod restarts to avoid empty diagnostic downloads.

Cause

The default diagnostics log retention period is set to seven days, which accelerates volume saturation when combined with the active file descriptor leak in the Technical Preview build.

Remedy

You can reduce the value of the LOG_RETENTION_DAYS environment variable to slow down how fast the volume fills. Because the diagnostics service is a subchart of the umbrella deployment, you can safely edit the StatefulSet environment variables directly as a stopgap measure.

  1. Set the log retention period environment variable to the floor value of one day.
    kubectl set env statefulset/diagnostics -n awc-diagnostics LOG_RETENTION_DAYS=1
  2. Wait for the rolling restart configuration rollout to complete across your instances.
    kubectl rollout status statefulset/diagnostics -n awc-diagnostics
  3. Confirm that the new environment variable value is active on the running pod.
    kubectl exec -n awc-diagnostics diagnostics-0 -- env | grep LOG_RETENTION_DAYS
  4. Verify from the log output that the diagnostics service recognized the modification at startup.
    kubectl logs -n awc-diagnostics diagnostics-0 | grep "Log retention"
  5. The returned log statement must display a confirmation message: Log retention: 1 days, prune interval: 6 hours.