Skip to content
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

Add write feature to ESTaskHandler #44973

Conversation

Owen-CH-Leung
Copy link
Contributor

@Owen-CH-Leung Owen-CH-Leung commented Dec 17, 2024

For remote logging with Elasticsearch, currently only reading log is supported. Users need to deploy other softwares (such as filebeat & logstash) to ship Airflow task logs to Elasticsearch. Also, user would need to ensure the log messages contain a valid log_id of format {dag_id}-{task_id}-{execution_date}-{try_number} in order for reading remote log to work.

This PR will enable the ElasticSearchTaskHandler to automatically write each task log to Elasticsearch after each DAG task is completed. 2 more config are introduced (namely: write_to_es and target_index, which are set to False and airflow-logs by default`)

The ElasticSearchTaskHandler will now also consider the config delete_local_logs in logging session. When both write_to_es and delete_local_logs are set to True, the handler will delete local task logs upon successfully writing logs to ES.

related: #42780

@Owen-CH-Leung Owen-CH-Leung marked this pull request as ready for review December 29, 2024 16:00
@eladkal eladkal force-pushed the Add-write-log-feature-to-ElasticSearchTaskHandler branch from 07b074f to 638992e Compare January 13, 2025 15:32
@eladkal eladkal added this to the Airflow 3.0.0 milestone Jan 13, 2025
@eladkal eladkal merged commit 05fe5a4 into apache:main Jan 13, 2025
62 checks passed
agupta01 pushed a commit to agupta01/airflow that referenced this pull request Jan 13, 2025
* Add write feature to ESTaskHandler
karenbraganz pushed a commit to karenbraganz/airflow that referenced this pull request Jan 13, 2025
* Add write feature to ESTaskHandler
HariGS-DB pushed a commit to HariGS-DB/airflow that referenced this pull request Jan 16, 2025
* Add write feature to ESTaskHandler
dauinh pushed a commit to dauinh/airflow that referenced this pull request Jan 24, 2025
* Add write feature to ESTaskHandler
got686-yandex pushed a commit to got686-yandex/airflow that referenced this pull request Jan 30, 2025
* Add write feature to ESTaskHandler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants