logging: trim constrained pod logs earlier
This commit is contained in:
parent
2b5c7ca10b
commit
6c816e9fad
@ -13,7 +13,7 @@ spec:
|
|||||||
template:
|
template:
|
||||||
metadata:
|
metadata:
|
||||||
annotations:
|
annotations:
|
||||||
logging.bstein.dev/node-log-rotation-rev: "2026-04-27-1"
|
logging.bstein.dev/node-log-rotation-rev: "2026-04-27-2"
|
||||||
labels:
|
labels:
|
||||||
app: node-log-rotation
|
app: node-log-rotation
|
||||||
spec:
|
spec:
|
||||||
|
|||||||
@ -106,7 +106,7 @@ trim_constrained_pod_logs() {
|
|||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
usage="$(df -P "${base}" | awk 'NR==2 {gsub(/%/, "", $5); print $5}')"
|
usage="$(df -P "${base}" | awk 'NR==2 {gsub(/%/, "", $5); print $5}')"
|
||||||
if [ -z "${usage}" ] || [ "${usage}" -lt 85 ]; 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' -size +1M -print -exec truncate -s 0 {} \; 2>/dev/null || true
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user