ashb commented on code in PR #53821:
URL: https://github.com/apache/airflow/pull/53821#discussion_r2241895873
##########
providers/elasticsearch/src/airflow/providers/elasticsearch/log/es_task_handler.py:
##########
@@ -661,13 +656,57 @@ def _get_result(self, hit: dict[Any, Any],
parent_class=None) -> Hit:
callback: type[Hit] | Callable[..., Any] = getattr(doc_class,
"from_es", doc_class)
return callback(hit)
- def _parse_raw_log(self, log: str) -> list[dict[str, Any]]:
+
+def getattr_nested(obj, item, default):
+ """
+ Get item from obj but return default if not found.
+
+ E.g. calling ``getattr_nested(a, 'b.c', "NA")`` will return
+ ``a.b.c`` if such a value exists, and "NA" otherwise.
+
+ :meta private:
+ """
+ try:
+ return attrgetter(item)(obj)
+ except AttributeError:
+ return default
+
+
[email protected](kw_only=True)
+class ElasticsearchRemoteLogIO(LoggingMixin): # noqa: D101
+ host: str
+ target_index: str
+ base_log_folder: Path = attrs.field(converter=Path)
+ delete_local_copy: bool
+
+ processors = ()
Review Comment:
This should probably be set up as a processor so that log messages get sent
to ElasticSearch as soon as they are written, just once when the log is
"closed". See CloudWatch logging handler for the only example we have right now.
That can be a future PR though.
--
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]