jason810496 commented on code in PR #53821:
URL: https://github.com/apache/airflow/pull/53821#discussion_r2312046940
##########
providers/elasticsearch/src/airflow/providers/elasticsearch/log/es_task_handler.py:
##########
@@ -368,7 +396,19 @@ def _read(
# If we hit the end of the log, remove the actual end_of_log message
# to prevent it from showing in the UI.
def concat_logs(hits: list[Hit]) -> str:
- log_range = (len(hits) - 1) if hits[-1].message ==
self.end_of_log_mark else len(hits)
+ # In Airflow 2.x, the log record JSON has a "message" key, e.g.:
+ # {
+ # "message": "Dag name:dataset_consumes_1 queued_at:2025-08-12
15:05:57.703493+00:00",
+ # "offset": 1755011166339518208,
+ # "log_id":
"dataset_consumes_1-consuming_1-manual__2025-08-12T15:05:57.691303+00:00--1-1"
+ # }
+ #
+ # In Airflow 3.x, the "message" field is renamed to "event".
+ # We check the correct attribute depending on the Airflow major
version.
+ if AIRFLOW_V_3_0_PLUS:
+ log_range = (len(hits) - 1) if hits[-1].event ==
self.end_of_log_mark else len(hits)
Review Comment:
Yeah, there _might_ be problem with 2.11.x, we haven't tested it yet.
We can test the backward compatibility with the following command:
```bash
breeze start-airflow --python 3.10 --backend postgres --integration
elasticsearch --mount-sources providers-and-tests --use-airflow-version 2.11.0
```
--
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]