Skip to content

Look up task logs by task try UUID - #74204

Merged
ashb merged 8 commits into
mainfrom
provider-log-ti-id
Oct 5, 2026
Merged

ashb merged 8 commits into
mainfrom
provider-log-ti-id

Conversation

@ashb

@ashb ashb commented Oct 4, 2026 •

Copy link
Copy Markdown
Member

These handlers previously identified a task's logs by coordinates (dag,
task, run, map index, try number). Once a task can run in several loop
passes that share those coordinates, the identity has to come from
something that is unique per attempt, and with the ownership change
every try already has its own UUID.

Elasticsearch and OpenSearch entries now carry the task instance's id as
ti_id and Cloud Logging entries carry it as a label of the same
name, next to the existing log_id or labels, so the human-readable
identity and any Kibana or Logs Explorer, etc. queries built on them
continue to work. Readers match on that id alone, or fall back to the
log_id or labels for entries that have no ti_id, so logs written
before this change stay readable without reindexing.

ti_id is where the task process has bound the UUID in to its own log
lines since 3.3, so entries from 3.3 onward already match. Nothing
earlier wrote it, and most lines the supervisor logs itself do not
carry it either, so the Elasticsearch and OpenSearch uploaders add it to
every line they ship.

Readers only match on the id from Airflow 3.4+. Prior to that, in 99.99% of cases the UUID was unique, (possibly 100% of cases that could write task logs) but it felt safer to make this conditional based on the release containing #73554 to be safe.

I used Claude Sonnet 5.5 on this one for help with writing the query syntax and tests of the ES/OS branches.

These handlers previously identified a task's logs by coordinates (dag,
task, run, map index, try number). Once a task can run in several loop
passes that share those coordinates, the identity has to come from
something that is unique per attempt, and with the ownership change
every try already has its own UUID.

Elasticsearch and OpenSearch entries now carry the task instance's id as
``ti_id`` and Cloud Logging entries carry it as a label of the same
name, next to the existing log_id or labels, so the human-readable
identity and any Kibana or Logs Explorer, etc. queries built on them
continue to work. Readers match on that id alone, or fall back to the
log_id or labels for entries that have no ``ti_id``, so logs written
before this change stay readable without reindexing.

``ti_id`` is where the task process has bound the UUID in to its own log
lines since 3.3, so entries from 3.3 onward already match. Nothing
earlier wrote it, and most lines the supervisor logs itself do not
carry it either, so the Elasticsearch and OpenSearch uploaders add it to
every line they ship.

Readers only match on the id from Airflow 3.4. Before then clearing a
task instance gives the live row a new id, so it may no longer be the id
its logs were written under, and earlier versions keep matching on
log_id or labels alone. Downloading every try on Google Cloud Logging
drops the id condition just as it already drops the try number.

Co-Authored-By: Claude <noreply@anthropic.com>

@kaxil kaxil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, a few non-blocking comments inline.

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.

5 participants