ysskrishna logoysskrishna

Airflow Logs Cleanup

Stop Airflow log buildup from quietly eating your disk. Schedule the trim once.

Get it
Built with
Experimental Projects
DevOps & Infrastructure
Scheduling
Airflow
Bash
Python
Details
FreeMIT licenseCreated May 18, 2025Updated November 12, 2026
Share this product

Your Airflow home is growing. Your disk is not.

Every run leaves another log behind. Rotations stack up. Empty folders linger after you delete the obvious files. You mean to clean on the weekend, then a monitoring alert beats you to it.

Airflow Logs Cleanup is a small Python utility that deletes aged log files and prunes empty directories on a schedule you control, as a one-off script or an Airflow DAG.

Set the retention rule once. Let the job run.

What you get

  • Less manual housekeeping. Automated passes remove old log files and rotated dag processor manager logs so you are not guessing which files are safe to delete.
  • A default you can change. The shipped retention window is seven days unless you edit the constant in the repository scripts.
  • Two ways to run it. Fire the cleanup manually when you want, or drop in the example DAG and enable it in the UI.
  • Tidier log folders. Empty directories left after deletion are removed, with safeguards for sensitive paths described in the project docs.
  • Failures that do not halt the run. Missing paths, permission problems, and a missing home variable are logged and the cleanup continues where it can.
  • Free and open source. MIT licensed on GitHub.

Picture a quiet Tuesday morning

For example, your team enables the example DAG before log volume becomes an incident. It runs on its daily schedule while you focus on failing tasks, not on which dated folders under your Airflow home are safe to remove.

Ready to try it?

Keep exploring

Frequently asked questions

Why not just write my own cron job?

You can. This repository already encodes a retention policy, handles rotated dag processor manager logs, prunes empty directories, and ships an example DAG on a daily schedule so you are not maintaining one-off shell rules.

How do I stop Airflow logs from filling my disk?

Run the cleanup on a schedule. By default it removes general log files older than seven days, deletes numbered rotations of dag processor manager logs, and removes empty directories afterward.

Can I run it once by hand before I enable the DAG?

Yes. Use the standalone entry point when you want an immediate pass, then add the DAG when you are ready for daily runs (the example runs at 3:00 AM unless you change the schedule in the DAG definition).

What does it delete, and what does it leave alone?

It removes rotated dag processor manager logs, log files past the retention window, and empty directories after deletion, excluding dag processor manager paths called out in the README. The README describes on-disk log files and folders only.

How do I keep logs longer for audits?

Edit the milliseconds retention constant in the script or DAG file to match your policy before you enable automatic deletion.

What do I need on the server?

Python 3.8 or newer, an Airflow install that supports PythonOperator, and the Airflow home environment variable set to your installation path.

Is it free?

Yes. It is open source under the MIT license.

Continue exploring

BlogCover image for How to Automate Airflow Log Cleanup and Reclaim Disk Space

How to Automate Airflow Log Cleanup and Reclaim Disk Space

Airflow
Bash
+3
3 min read
ToolCover image for Unix Timestamp Converter

Unix Timestamp Converter

Epoch converter for Unix seconds/milliseconds to date and date to epoch.

Scheduling
Text & Data Conversion
ProductnpmCron GUI

Cron GUI

Stage cron jobs in the browser. Deploy only when the preview looks right.
Scheduling
NPM Packages
+6
BlogCover image for OSC 7501 in Python: Tell the Terminal When Your CLI Is Working, Blocked or Done

OSC 7501 in Python: Tell the Terminal When Your CLI Is Working, Blocked or Done

Python
Python CLI
+1
3 min read
ProductEmail Audit Rules Engine

Email Audit Rules Engine

Repeatable scores for outbound customer replies your team can explain without rereading every thread.
Experimental Projects
Python
+2
BlogCover image for caffeinate for Windows: Keep a Locked-Down Laptop Awake Without Installing Anything

caffeinate for Windows: Keep a Locked-Down Laptop Awake Without Installing Anything

DevOps & Infrastructure
PowerShell
4 min read