Skip to content

Container Log Groomer should be configurable with a log retention time <1d - OTEL Collector FileLogReceiver #61814

Closed

Description

@n-badtke-cg

Description

Hi, thank you for the amazing ecosystem ❤️

We are using remote_logging and want to somehow use delete_local_logs, but with a delay (we are exporting the logs using OpenTelemetry Collector FileLog Receiver)

So in our current solution, we have set logging.delete_local_logs = "False" and the environment variable AIRFLOW__LOG_RETENTION_DAYS=1. The env is getting used in https://github.com/apache/airflow/blob/main/scripts/docker/clean-logs.sh

Now, even with only 1d retention, there are too many logs in our system, and the OTEL FileLog Receiver is unfortunately working very poorly with many files, I guess the receiver uses polling in some way.

The https://github.com/apache/airflow/blob/main/scripts/docker/clean-logs.sh script is using the command
find -type f -mtime +${RETENTION} where RETENTION is set to the AIRFLOW__LOG_RETENTION_DAYS env.

Why not just use (or additionally offer) AIRFLOW__LOG_RETENTION_MINUTES with find -type f -mmin +${RETENTION_MINUTES}? 🙂

Use case/motivation

More granular configuration option for log retention and thus better offering for largely scaled systems

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. boring-cyborg commented on Feb 12, 2026

    @boring-cyborg

    Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

  2. removed
    needs-triagelabel for new issues that we didn't triage yet
    on Feb 12, 2026
  3. shahar1 commented on Feb 12, 2026

    @shahar1
    Contributor

    Thanks for suggesting, feel free to contribute a fix!

  4. pugarte7 commented on Feb 12, 2026

    @pugarte7
    Contributor

    Hi @shahar1! I think this could be a very good first issue for me! Could you assign it to me? I think the approach given by @n-badtke-cg could be a good idea.

  5. shreeharshshinde commented on Feb 13, 2026

    @shreeharshshinde

    I’ve worked on this and opened a PR implementing minute-level log retention while keeping the existing behavior unchanged. Please feel free to share any feedback or suggestions.

  6. pugarte7 commented on Feb 13, 2026

    @pugarte7
    Contributor

    Hi! I have created a PR to address this issue.
    I think it's has better flexibility and safety than previous proposals:

    • By defaulting AIRFLOW__LOG_RETENTION_MINUTES to 0, the script automatically falls back to the original daily retention logic. Users can toggle between minutes and days without breaking the cleanup cycle.
    • It preserves the existing script structure, including the logs.

    I have verified that there is not documentation talking about AIRFLOW__LOG_RETENTION_DAYS, but I'm happy to add a section for this new variable to ensure it's discoverable for Docker users.

    Also, if the maintainers agree with this logic, I am more than happy to extend this to the Helm Chart templates and update the relevant tests to keep everything in sync.

  7. n-badtke-cg commented on Feb 13, 2026

    @n-badtke-cg
    ContributorAuthor

    Ouh, we now have two PRs open for this issue 😅

  8. n-badtke-cg commented on Feb 13, 2026

    @n-badtke-cg
    ContributorAuthor

    @Wastelander777 look into #61853 , there are already some refinements

    But thank you @Wastelander777 anyway <3 also already a thanks to @shreeharshshinde

  9. n-badtke-cg commented on Feb 13, 2026

    @n-badtke-cg
    ContributorAuthor

    Okay, three PRs now?

  10. n-badtke-cg commented on Feb 16, 2026

    @n-badtke-cg
    ContributorAuthor

    I’ve worked on this and opened a PR implementing minute-level log retention while keeping the existing behavior unchanged. Please feel free to share any feedback or suggestions.

    The first PR #61853 got closed without a good reason imo. @potiuk please elaborate

  11. potiuk commented on Feb 17, 2026

    @potiuk
    Member

    Yeah. Accidental. You need to make sure to fix the issues there (are conflicts and static checks are failing) .

  12. potiuk commented on Feb 17, 2026

    @potiuk
    Member

    I reopened it.

  13. pugarte7 commented on Mar 6, 2026

    @pugarte7
    Contributor

    Hi @n-badtke-cg! I have updated the PR with the latest updates, and fixing the errors that were found on @shreeharshshinde 's branch. I have also added him as a co-author on the PR. Thank you!

  14. n-badtke-cg commented on Mar 6, 2026

    @n-badtke-cg
    ContributorAuthor

    Hi @n-badtke-cg! I have updated the PR with the latest updates, and fixing the errors that were found on @shreeharshshinde 's branch. I have also added him as a co-author on the PR. Thank you!

    @Wastelander777 I've reviewed #61855

  15. n-badtke-cg commented on Mar 12, 2026

    @n-badtke-cg
    ContributorAuthor

    PR #61855 was merged but accidentally included a bug unfortunately.
    Currently, there is no follow up PR yet.

    Update: I created PR #63421

    Update 2: Issues fixed with merge of PR #63421

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions