feat(docker): add minute-level log retention to clean-logs script#61855
feat(docker): add minute-level log retention to clean-logs script#61855jscheffl merged 6 commits intoapache:mainfrom
Conversation
|
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
|
Duplication with #61853 |
5483b2f to
772b333
Compare
|
@Wastelander777 This PR has been converted to draft because it does not yet meet our Pull Request quality criteria. Issues found:
What to do next:
Converting a PR to draft is not a rejection — it is an invitation to bring the PR up to the project's standards so that maintainer review time is spent productively. If you have questions, feel free to ask on the Airflow Slack. |
e296f06 to
61d4562
Compare
|
Hi @n-badtke-cg @potiuk !! I have addressed the comments, and the code is passing the CI issues, it should be ready to merge. Feel free to request anything else. Thank you! |
This PR is currently the most progressed one. |
|
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
…s script (#61855) * feat(docker): add minute-level log retention support to clean-logs.sh * feat(docker): import coauthored changes * update inlined scripts in Dockerfile * comments fixed (cherry picked from commit de01a6b) Co-authored-by: Pablo Ugarte <99680272+Wastelander777@users.noreply.github.com>
Backport successfully created: v3-1-testNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
|
| @@ -45,10 +46,12 @@ fi | |||
| retention_days="${RETENTION}" | |||
There was a problem hiding this comment.
There is a bug here = RETENTION is sttill used here @Wastelander777
There was a problem hiding this comment.
Ups, my bad 😣. What should be the approach? How can I fix that? Do I re-open the issue?
There was a problem hiding this comment.
sorry, went over my head too :/
Do I re-open the issue?
no, the PR is already merged, there needs to be a new PR unfortunately
|
@jscheffl -> I was just about to post this comment before you merged :) |
Sorry... are you on a correction or shall I? |
…ache#61855) * feat(docker): add minute-level log retention support to clean-logs.sh * feat(docker): import coauthored changes * update inlined scripts in Dockerfile * comments fixed
…ache#61855) * feat(docker): add minute-level log retention support to clean-logs.sh * feat(docker): import coauthored changes * update inlined scripts in Dockerfile * comments fixed
| @@ -45,10 +46,12 @@ fi | |||
| retention_days="${RETENTION}" | |||
There was a problem hiding this comment.
sorry, went over my head too :/
Do I re-open the issue?
no, the PR is already merged, there needs to be a new PR unfortunately
|
I created PR #63421 |
|
Issues fixed with merge of #63421 |
…ache#61855) * feat(docker): add minute-level log retention support to clean-logs.sh * feat(docker): import coauthored changes * update inlined scripts in Dockerfile * comments fixed
What does this PR support?
I’m adding the possibility to define an environment variable to clean logs on a minute basis instead of just days, which is how it works right now.
New variable:
AIRFLOW__LOG_RETENTION_MINUTESWhy?
Many users, like @n-badtke-cg (the issue opener), needed a more atomic way of getting rid of logs. In big projects, waiting a full day to clean logs isn't optimal, as the files pile up so fast that it makes debugging difficult and storage expensive.
How?
I’ve updated scripts/docker/clean-logs.sh with some conditional logic:
If
AIRFLOW__LOG_RETENTION_MINUTESis set and bigger than 0, the script uses find -mmin.Otherwise, it falls back to the existing -mtime (day-based) logic.
The default is 0, so nothing changes for users unless they opt-in. This also makes it easy to "rollback" to daily cleanup just by setting the minutes back to 0.
Backward Compatibility
There are no breaking changes here. I’ve maintained the existing logic, and the new minute-level option follows the exact same structure that’s already there. If you don't touch the new variable, Airflow behaves exactly as it did before.
Testing
I verified this locally by creating test log files.
Confirmed that it deletes files correctly based on minute-level thresholds.
Confirmed it still falls back to day-based retention when the minute variable is 0 or unset.
Co-authored-by: shreeharshshinde shreeharshshinde@users.noreply.github.com
Closes #61814