Skip to content

All Airflow task logs are being written into a single file logfile_2024_03_03.log on S3 and cloudwatch #51143

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 of 2 tasks
Krishna-skk opened this issue May 28, 2025 · 1 comment
Labels
area:core area:logging kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet

Comments

@Krishna-skk
Copy link

Krishna-skk commented May 28, 2025

Apache Airflow version

Other Airflow 2 version (please specify below)

If "Other Airflow 2 version" selected, which one?

2.10.4

What happened?

Environment:

  • Airflow version: 2.10.4
  • Python version: 3.10
  • Deployment: ECS Fargate (Dockerized Airflow)
  • Remote Logging: Enabled using Amazon S3

#Problem Description

I've configured Airflow to use remote logging with S3, and logs are successfully uploaded to my S3 bucket. However, all task logs—regardless of DAG, task, or attempt—are written to a single file named:

logfile_2024_03_03.log

This is unexpected, as I have set the log_filename_template in airflow.cfg to follow Airflow’s structured directory format, yet it is being ignored.

#Current Relevant Config in airflow.cfg

remote_logging = True
remote_base_log_folder = s3://quicflow-airflow-logs-bucket/airflow-logs
remote_log_conn_id = aws_default
delete_local_logs = True

log_filename_template = dag_id={{ ti.dag_id }}/run_id={{ ti.run_id }}/task_id={{ ti.task_id }}/{% if ti.map_index >= 0 %}map_index={{ ti.map_index }}/{% endif %}attempt={{ try_number }}.log
log_processor_filename_template = {{ filename }}.log

#What I’ve Tried

  • Checked airflow.cfg thoroughly — there is no base_log_folder setting (Airflow should fall back to the default /opt/airflow/logs).
  • I do not have any custom logging_config_class.
  • Removed .log suffix from log_processor_filename_template — no effect.
  • Checked S3 bucket — only one file logfile_2024_03_03.log keeps getting overwritten by every new task run.
  • I’m not setting AIRFLOW__LOGGING__BASE_LOG_FOLDER as an environment variable.

#Errors/Warnings Observed

I also see this warning in the logs:

FileNotFoundError: [Errno 2] No such file or directory: '/opt/airflow/logs/logfile_2024_03_03.log'

What you think should happen instead?

No response

How to reproduce

#Questions

  1. Why is Airflow not honoring the log_filename_template setting?
  2. Where is logfile_2024_03_03.log even coming from? I’ve never specified this anywhere.
  3. Could it be falling back to a default handler or using StreamLogHandler due to a misconfigured log_processor_filename_template?

Any help in resolving this issue would be greatly appreciated! Let me know if you need me to share the full airflow.cfg.

Operating System

Linux

Versions of Apache Airflow Providers

No response

Deployment

Other Docker-based deployment

Deployment details

I have dockerized the airflow with version 2.10.4 and deployed the airflow on Aws ECS as fargate containers

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

@Krishna-skk Krishna-skk added kind:bug This is a clearly a bug area:core needs-triage label for new issues that we didn't triage yet labels May 28, 2025
Copy link

boring-cyborg bot commented May 28, 2025

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.

@dosubot dosubot bot added the area:logging label May 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:core area:logging kind:bug This is a clearly a bug needs-triage label for new issues that we didn't triage yet
Projects
None yet
Development

No branches or pull requests

1 participant