jason810496 commented on code in PR #70295:
URL: https://github.com/apache/airflow/pull/70295#discussion_r3696081992
##########
providers/opensearch/docs/logging/index.rst:
##########
@@ -44,6 +44,22 @@ First, to use the handler, ``airflow.cfg`` must be
configured as follows:
username = <username>
password = <password>
+On Airflow 3.x you can also route remote logging to OpenSearch through the
provider
+dispatch mechanism by adding an ``opensearch://`` scheme to
+``[logging] remote_base_log_folder``:
Review Comment:
```suggestion
On Airflow 3.3.0 or above you can also route remote logging to OpenSearch
through the provider dispatch mechanism by adding an ``opensearch://`` scheme
to ``[logging] remote_base_log_folder``:
```
##########
providers/opensearch/src/airflow/providers/opensearch/log/os_task_handler.py:
##########
@@ -873,6 +874,43 @@ class OpensearchRemoteLogIO(LoggingMixin): # noqa: D101
processors = ()
+ @classmethod
+ def from_config(cls) -> OpensearchRemoteLogIO:
+ """Build the remote log IO from Airflow logging and ``[opensearch]``
configuration."""
+ remote_task_handler_kwargs = conf.getjson("logging",
"remote_task_handler_kwargs", fallback={})
+ if not isinstance(remote_task_handler_kwargs, dict):
+ raise ValueError(
+ "logging/remote_task_handler_kwargs must be a JSON object (a
python dict), we got "
+ f"{type(remote_task_handler_kwargs)}"
+ )
+ # remote_task_handler_kwargs mixes FileTaskHandler kwargs with IO
kwargs; only the
+ # latter belong to this class (same split as
airflow_local_settings.py).
+ fth_params =
frozenset(inspect.signature(FileTaskHandler.__init__).parameters) - {
+ "self",
+ "base_log_folder",
+ }
+ io_kwargs = {k: v for k, v in remote_task_handler_kwargs.items() if k
not in fth_params}
+ port = conf.get("opensearch", "port", fallback="")
Review Comment:
```suggestion
port = conf.getint("opensearch", "port", fallback=9200)
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]