Skip to content

Commit

Permalink
Fix logic of clean log for find cmd arg of retention
Browse files Browse the repository at this point in the history
  • Loading branch information
goodseeyou committed Apr 29, 2024
1 parent 28a240a commit 40fa352
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions scripts/docker/clean-logs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
set -euo pipefail

readonly DIRECTORY="${AIRFLOW_HOME:-/usr/local/airflow}"
readonly RETENTION="${AIRFLOW__LOG_RETENTION_DAYS:-15}"
readonly RETENTION="${AIRFLOW__LOG_RETENTION_DAYS:15}"

trap "exit" INT TERM

Expand All @@ -32,7 +32,7 @@ while true; do
echo "Trimming airflow logs to ${RETENTION} days."
find "${DIRECTORY}"/logs \
-type d -name 'lost+found' -prune -o \
-type f -mtime +"${RETENTION}" -name '*.log' -print0 | \
-type f -mtime -"${RETENTION}" -name '*.log' -print0 | \
xargs -0 rm -f || true

find "${DIRECTORY}"/logs -type d -empty -delete || true
Expand Down

0 comments on commit 40fa352

Please sign in to comment.