Skip to content

Add write log capacity to ElasticsearchTaskHandler & OpensearchTaskHandler #42780

Description

@Owen-CH-Leung

Description

According to the aws provider doc, when enabling remote logging, the CloudwatchTaskHandler and S3TaskHandler supports both reading & writing task logs

https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/logging/index.html

As for remote logging with Elasticsearch / Opensearch, currently only reading log is supported. Users need to deploy other softwares (such as filebeat & logstash) to ship Airflow task logs to Elasticsearch / Opensearch. 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.

Wouldn't be nice if Airflow supports writing each task log to Elasticsearch / Opensearch, after each DAG task is completed ? Similar to S3TaskHandler, once remote logging is properly configured, DAG task log will automatically be written to, and read from Elasticsearch / Opensearch, and users need not deploy additional software to ship task logs

Use case/motivation

Similar to S3TaskHandler, ElasticsearchTaskHandler and OpensearchTaskHandler should support automatically writing task logs to destination.

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions