Title
Create new category
Edit page index title
Edit category
Edit link
Airflow Log Clean up and DAG Management
Disable Example DAGs
Some example DAGs generate a significant amount of data as they run daily. To prevent excessive log accumulation and resource consumption, it is recommended to disable them.
Steps to Disable Example DAGs
Open the
airflow.cfgconfiguration file.Locate the parameter
load_examples = True.Change it to
load_examples = False.

Restart the Airflow webserver and scheduler.
Alternatively, you can manually disable the DAGs from the Airflow UI by pausing them.
Example DAG Logs Location

Airflow Log Cleanup DAG
Airflow generates a large number of logs over time, especially for example DAGs and other scheduled tasks. These logs accumulate in the scheduler directory, consuming significant disk space.
To address this, we can deploy an Airflow DAG that periodically removes old log files from the scheduler directory. This cleanup process helps optimize storage usage and maintain a more efficient Airflow environment.
Implementation Details
This DAG performs the following tasks:
Deletes log files older than a specified number of days.
Removes empty directories to maintain a clean log structure.
Runs daily at 1 AM to ensure logs are regularly cleaned.
DAG Configuration


Key Parameters
Parameter | Description |
|---|---|
| Runs the cleanup daily at 1 AM. |
| Removes logs older than 1 day (can be adjusted as needed). |
| Deletes all |
| Removes empty directories after cleanup. |
Deployment Steps
Save the DAG file as
airflow_log_cleanup.pyinside the Airflow DAGs directory.Enable the DAG in the Airflow UI (DAGs →
airflow_log_cleanup→ Toggle ON ✅).Monitor logs and disk space to confirm cleanup efficiency.
Benefits
Automated log cleanup reduces manual intervention.
Prevents log file buildup, improving storage management.
Keeps Airflow scheduler directory clean for better performance.