Skip to content

Retrieving logs for previous task attempts uses the wrong task instance ID #51525

Closed

Description

@ianbuss

Apache Airflow version

3.0.1

If "Other Airflow 2 version" selected, which one?

No response

What happened?

The URL template for log retrieval for task instance attempts uses the current TI ID from the task_instance table, not the TI ID for the attempt itself (which is now in the TI history table). This breaks log retrieval if providing a non-default log_filename_template which references the ID e.g. {{ ti.id }}.

What you think should happen instead?

The log retrieval logic should set the TI ID in the template expansion to the ID of the actual attempt.

How to reproduce

Set the log filename template to something non-default including {{ ti.id }}. Run a task and validate logs can be retrieved. Clear the task instance and try to retrieve logs for the previous attempt.

Operating System

Debian GNU/Linux

Versions of Apache Airflow Providers

No response

Deployment

Astronomer

Deployment details

No response

Anything else?

No response

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Activity

  1. added
    kind:bug
    needs-triage
    on Jun 9, 2025
  2. added
    priority:medium
    on Jun 9, 2025
  3. added this to the Airflow 3.0.3 milestone on Jun 9, 2025
  4. sunank200 commented on Jun 9, 2025

    @sunank200
    Collaborator

    I can take a look at this @phanikumv

  5. self-assigned this
    on Jun 9, 2025
  6. removed
    needs-triage
    on Jun 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area:corearea:loggingkind:bugpriority:medium

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions