All Airflow task logs are being written into a single file logfile_2024_03_03.log on S3 and cloudwatch #51143
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
Uh oh!
There was an error while loading. Please reload this page.
Apache Airflow version
Other Airflow 2 version (please specify below)
If "Other Airflow 2 version" selected, which one?
2.10.4
What happened?
Environment:
#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
inairflow.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
airflow.cfg
thoroughly — there is nobase_log_folder
setting (Airflow should fall back to the default/opt/airflow/logs
).logging_config_class
..log
suffix fromlog_processor_filename_template
— no effect.logfile_2024_03_03.log
keeps getting overwritten by every new task run.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
log_filename_template
setting?logfile_2024_03_03.log
even coming from? I’ve never specified this anywhere.StreamLogHandler
due to a misconfiguredlog_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?
Code of Conduct
The text was updated successfully, but these errors were encountered: