potiuk commented on code in PR #31955:
URL: https://github.com/apache/airflow/pull/31955#discussion_r1245016382
##########
scripts/docker/clean-logs.sh:
##########
@@ -21,19 +21,30 @@ set -euo pipefail
readonly DIRECTORY="${AIRFLOW_HOME:-/usr/local/airflow}"
readonly RETENTION="${AIRFLOW__LOG_RETENTION_DAYS:-15}"
+readonly DELETE_LOGS_FOLDERS="${AIRFLOW__LOG_DELETE_FOLDERS:-true}"
trap "exit" INT TERM
readonly EVERY=$((15*60))
+echo "Running the improved cleaning logs..."
echo "Cleaning logs every $EVERY seconds"
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 | \
- xargs -0 rm -f
+ if [[ "${DELETE_LOGS_FOLDERS}" == "true" ]]
+ then
+ echo "Trimming airflow logs folders to ${RETENTION} days."
+ find "${DIRECTORY}"/logs \
+ -type d -name 'lost+found' -prune -o \
+ -type d -mtime +"${RETENTION}" -print0 | \
Review Comment:
Good point @jedcunningham adding `-empty` predicate in find should solve
the issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]