airflow icon indicating copy to clipboard operation
airflow copied to clipboard

Log rotation for scheduler logs

Open singhania opened this issue 6 years ago • 7 comments

Description Currently airflow scheduler doesn't support any kind of log rotation which cause scheduler to go down.

Use case / motivation A log rotation based upon duration/size will make sure scheduler's disks are not filled and will not cause downtime for scheduler.

Related Issues Worker logs cleanup can be currently done via maintenance dag but same is not possible for scheduler logs.

singhania avatar May 07 '20 07:05 singhania

Thanks for opening your first issue here! Be sure to follow the issue template!

boring-cyborg[bot] avatar May 07 '20 07:05 boring-cyborg[bot]

We solved this removing old logs after x days but out of the box rotating would be nice.

halilduygulu avatar May 25 '20 12:05 halilduygulu

Our internal environment enforces mandatory log rotation automatically as part of its log rotation and archiving mechanism. Since the description of this ticket points out that external log rotation causes the Scheduler to go down (I am assuming this means crash), this leaves me hanging.

External log rotators are pretty common. For maximum compatibility, all Airflow subsystems need to play nice with external log rotators.

vitaly-krugl avatar Sep 10 '20 23:09 vitaly-krugl

But this external log deletion dag / script doesn't seem to cause the scheduler to go down https://github.com/teamclairvoyant/airflow-maintenance-dags/blob/master/log-cleanup/airflow-log-cleanup.py

dutta1kartik3 avatar Sep 11 '20 02:09 dutta1kartik3

Would love to see this feature implemented We are too handling this through cronjob and it would be great to have a native solution.

MindTheGap32 avatar Nov 19 '20 10:11 MindTheGap32

Yes, this function would be very useful for us. Rotating the scheduler logs in the ECS container out of the box would be great.

chillivilli avatar Jul 14 '21 08:07 chillivilli

In modern deployments logs are handled usually by the deployment/externally. I do not think rotating the logs makes airflow Crash (that would be pretty suriprising given than airlfow uses standard python logging). I am closing that one unless some provides some arguments why it should be implement, or shows how external log rotation crashes airflow.

potiuk avatar Jul 19 '21 20:07 potiuk