-
Notifications
You must be signed in to change notification settings - Fork 16.9k
feat(docker): add minute-level log retention to clean-logs script #61855
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0418328
e8206b6
c93b924
61d4562
d264e95
7d2945c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,7 +20,8 @@ | |
| set -euo pipefail | ||
|
|
||
| readonly DIRECTORY="${AIRFLOW_HOME:-/usr/local/airflow}" | ||
| readonly RETENTION="${AIRFLOW__LOG_RETENTION_DAYS:-15}" | ||
| readonly RETENTION_DAYS="${AIRFLOW__LOG_RETENTION_DAYS:-15}" | ||
| readonly RETENTION_MINUTES="${AIRFLOW__LOG_RETENTION_MINUTES:-0}" | ||
| readonly FREQUENCY="${AIRFLOW__LOG_CLEANUP_FREQUENCY_MINUTES:-15}" | ||
| readonly MAX_PERCENT="${AIRFLOW__LOG_MAX_SIZE_PERCENT:-0}" | ||
|
|
||
|
|
@@ -45,10 +46,12 @@ fi | |
| retention_days="${RETENTION}" | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a bug here = RETENTION is sttill used here @Wastelander777
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ups, my bad 😣. What should be the approach? How can I fix that? Do I re-open the issue?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sorry, went over my head too :/
no, the PR is already merged, there needs to be a new PR unfortunately |
||
|
|
||
| while true; do | ||
| echo "Trimming airflow logs to ${retention_days} days." | ||
| total_retention_minutes=$(( (RETENTION_DAYS * 1440) + RETENTION_MINUTES )) | ||
| echo "Trimming airflow logs older than ${total_retention_minutes} minutes." | ||
|
|
||
| find "${DIRECTORY}"/logs \ | ||
| -type d -name 'lost+found' -prune -o \ | ||
| -type f -mtime +"${retention_days}" -name '*.log' -print0 | \ | ||
| -type f -mmin +"${total_retention_minutes}" -name '*.log' -print0 | \ | ||
| xargs -0 rm -f || true | ||
|
|
||
| if [[ "$MAX_SIZE_BYTES" -gt 0 && "$retention_days" -ge 0 ]]; then | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.