Skip to content

Fix WASB remote logging base path handling (#58946)#61013

Merged
jason810496 merged 8 commits intoapache:mainfrom
nailo2c:fix-58946_wasb_prefix_issue
Feb 25, 2026
Merged

Fix WASB remote logging base path handling (#58946)#61013
jason810496 merged 8 commits intoapache:mainfrom
nailo2c:fix-58946_wasb_prefix_issue

Conversation

@nailo2c
Copy link
Contributor

@nailo2c nailo2c commented Jan 24, 2026

Closes: #58946

Why

Following this doc causes Airflow to write logs under an unexpected <no name> folder in Azure Blob Storage.

issue-58946-reproduce

How

wasb is used as a flag to select the Azure Blob remote logging implementation, but the current code path does not normalize the wasb:// scheme.

elif remote_base_log_folder.startswith("wasb"):
from airflow.providers.microsoft.azure.log.wasb_task_handler import WasbRemoteLogIO


In the documentation prior to version 12.4.1, users were instructed to use a wasb- prefix (e.g. wasb-logs). However, PR #51988 notes that this could lead to ResourceNotFoundError and authentication failures.

As a result, the documentation was updated to the current guidance (using remote_base_log_folder = wasb://...):

But the current implementation treats wasb:// as part of the blob name when constructing the remote log path:

  1. wasb-logs (works)
self.remote_base = "wasb-logs"
os.path.join("wasb-logs", "dag_id=xxx/task_id=yyy/attempt=1.log")                                                                       

# Result: "wasb-logs/dag_id=xxx/task_id=yyy/attempt=1.log"                                                                                
# This is a valid Azure Blob name
  1. wasb://logs (problematic)
self.remote_base = "wasb://logs"
os.path.join("wasb://logs", "dag_id=xxx/task_id=yyy/attempt=1.log")

# Result: "wasb://logs/dag_id=xxx/task_id=yyy/attempt=1.log"
# The `wasb://` scheme is being treated as part of the blob name.
# In Azure Portal, this ends up looking like a weird virtual folder structure,
# e.g. `wasb:` / `{No Name}` / `logs` / ..

What

Normalize remote_base_log_folder by stripping the wasb:// prefix before constructing the blob key:

if remote_base_log_folder.startswith("wasb://"):
    wasb_remote_base = remote_base_log_folder.removeprefix("wasb://")
else:
    wasb_remote_base = remote_base_log_folder

I intentionally did not change the selection logic to elif remote_base_log_folder.startswith("wasb://"): because I do not want to impact users who currently configure wasb-... in their settings.

elif remote_base_log_folder.startswith("wasb"):

Result:
issue-58946-fixed


Was generative AI tooling used to co-author this PR?
  • No (please specify the tool below)

Copy link
Contributor

@SameerMesiah97 SameerMesiah97 left a comment

Choose a reason for hiding this comment

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

Looks good to me. Just one tiny nit.

Overall, this is a very safe change that fixes a legitimate issue.

Copy link
Contributor

@kalluripradeep kalluripradeep left a comment

Choose a reason for hiding this comment

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

Nice fix! This addresses a real issue with the current documentation guidance.

The solution is clean and backward-compatible - stripping the wasb:// prefix while still supporting the legacy wasb- format is the right approach.

I agree with @SameerMesiah97 suggestion to add a comment explaining the normalization. Something like:

if remote_base_log_folder.startswith("wasb://"):
    # Strip wasb:// scheme to get clean blob path
    # Docs recommend wasb://container format but os.path.join treats scheme as part of path
    wasb_remote_base = remote_base_log_folder.removeprefix("wasb://")
else:
    # Support legacy wasb- prefix format for backward compatibility  
    wasb_remote_base = remote_base_log_folder

This would help future maintainers understand why this normalization exists.

Otherwise ! ✅

@nailo2c
Copy link
Contributor Author

nailo2c commented Jan 27, 2026

Thanks for the suggestion! I'm hesitant to make that change right now as I'm not sure if it fits the project norms. I'd prefer to wait and see what a committer thinks first.

@eladkal eladkal added this to the Airflow 3.1.7 milestone Jan 27, 2026
@eladkal eladkal added the type:bug-fix Changelog: Bug Fixes label Jan 27, 2026
@nailo2c
Copy link
Contributor Author

nailo2c commented Feb 2, 2026

Applied all suggestions, please let me know if anything else needs adjustment. Thanks :)

@alessandro-peyrachia-rnc

Thanks for the fix!
would it be a good idea to update docs to report this behaviour affecting versions from 12.4.1 up to 3.1.7?

@nailo2c
Copy link
Contributor Author

nailo2c commented Feb 20, 2026

Thanks for the suggestion! The bug fix will be recorded in the CHANGELOG, so users should be able to track affected versions from there. No need to worry :)

@jason810496 jason810496 added the backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch label Feb 25, 2026
Copy link
Member

@jason810496 jason810496 left a comment

Choose a reason for hiding this comment

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

Thanks for the fix!

@jason810496 jason810496 merged commit 726d4b5 into apache:main Feb 25, 2026
72 checks passed
github-actions bot pushed a commit that referenced this pull request Feb 25, 2026
* Fix WASB remote logging base path handling

* Fix WASB remote logging base path handling by simplifying prefix removal

* Clarify handling of WASB remote logging base path format in comments

* fix CI static checks error
(cherry picked from commit 726d4b5)

Co-authored-by: Aaron Chen <nailo2c@gmail.com>
@github-actions
Copy link

Backport successfully created: v3-1-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
v3-1-test PR Link

guan404ming pushed a commit that referenced this pull request Feb 25, 2026
…) (#62456)

* Fix WASB remote logging base path handling

* Fix WASB remote logging base path handling by simplifying prefix removal

* Clarify handling of WASB remote logging base path format in comments

* fix CI static checks error
(cherry picked from commit 726d4b5)

Co-authored-by: Aaron Chen <nailo2c@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ConfigTemplates area:logging backport-to-v3-1-test Mark PR with this label to backport to v3-1-test branch type:bug-fix Changelog: Bug Fixes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Azure remote logging config remote_base_log_folder not properly working

8 participants