logging: trim dated pod log rotations

This commit is contained in:
Brad Stein 2026-04-27 16:49:11 -03:00
parent 6c816e9fad
commit 4a6b54b4c3
2 changed files with 2 additions and 2 deletions

View File

@ -13,7 +13,7 @@ spec:
template: template:
metadata: metadata:
annotations: annotations:
logging.bstein.dev/node-log-rotation-rev: "2026-04-27-2" logging.bstein.dev/node-log-rotation-rev: "2026-04-27-3"
labels: labels:
app: node-log-rotation app: node-log-rotation
spec: spec:

View File

@ -109,7 +109,7 @@ trim_constrained_pod_logs() {
if [ -z "${usage}" ] || [ "${usage}" -lt 75 ]; then if [ -z "${usage}" ] || [ "${usage}" -lt 75 ]; then
continue continue
fi fi
find "${base}/pods" -type f -name '[1-9]*.log' -size +1M -print -exec truncate -s 0 {} \; 2>/dev/null || true find "${base}/pods" -type f \( -name '[1-9]*.log' -o -name '*.log.20*' \) -size +1M -print -exec truncate -s 0 {} \; 2>/dev/null || true
if [ -d "${base}/containers" ]; then if [ -d "${base}/containers" ]; then
find "${base}/containers" -xtype l -print -delete 2>/dev/null || true find "${base}/containers" -xtype l -print -delete 2>/dev/null || true
fi fi