Skip to content

UI: Add option to configure default task log source#64185

Open
AyushCoder9 wants to merge 4 commits intoapache:mainfrom
AyushCoder9:fix/issue-64159-default-ui-log-source
Open

UI: Add option to configure default task log source#64185
AyushCoder9 wants to merge 4 commits intoapache:mainfrom
AyushCoder9:fix/issue-64159-default-ui-log-source

Conversation

@AyushCoder9
Copy link

@AyushCoder9 AyushCoder9 commented Mar 24, 2026

Description

Introduces a new configuration setting api.default_ui_log_source to specify a default log source for reading task logs in the web UI instead of defaulting strictly to "All Sources".

  • Backend:

    • Added default_ui_log_source parameter within airflow/config_templates/config.yml under the [api] section.
    • Expose the parameter in the general UI payload models inside datamodels/ui/config.py and returned aggregator routing endpoints at routes/ui/config.py.
    • Regenerated UI openapi types to support the strictly typed fallback references.
  • Frontend:

    • Modified Logs.tsx query logic to fall back accurately on useConfig defaults when query search parameters for SOURCE are empty.
    • Adapted TaskLogHeader.tsx visually select mapping default layouts to represent the configured fallback parameters neatly.
    • Successfully verified linting and all unit tests passed flawlessly with 0 errors natively.

closes: #64159


@boring-cyborg
Copy link

boring-cyborg bot commented Mar 24, 2026

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
Here are some useful points:

  • Pay attention to the quality of your code (ruff, mypy and type annotations). Our prek-hooks will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it's a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Please follow ASF Code of Conduct for all communication including (but not limited to) comments on Pull Requests, Mailing list and Slack.
  • Be sure to read the Airflow Coding style.
  • Always keep your Pull Requests rebased, otherwise your build might fail due to changes not related to your commits.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://s.apache.org/airflow-slack

Comment on lines +87 to +94
const sourceFilters =
sourceFiltersParam.length > 0
? sourceFiltersParam.includes("all")
? []
: sourceFiltersParam
: defaultLogSource !== undefined && defaultLogSource !== "" && defaultLogSource !== "All Sources"
? [defaultLogSource]
: [];
Copy link
Contributor

Choose a reason for hiding this comment

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

Would love a UI unit test here to make sure that we properly respect config vs when a user manually changes the filter.

Copy link
Author

Choose a reason for hiding this comment

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

I've completed the implementation and verification for the api.default_ui_log_source configuration. Here is a concise comment you can use for the PR or GitHub issue:

Feature Implemented: api.default_ui_log_source configuration support.

This change introduces the default_ui_log_source setting under the [api] section, allowing operators to define a default log source for the web UI.

Key Highlights:

Backend: Added the config to config.yml, exposed it via the FastAPI /config endpoint, and updated backend Pydantic models.
Frontend: Implemented logic in Logs.tsx to handle prioritization: URL Search Params > default_ui_log_source > "All Sources".
UI Consistency: Updated

TaskLogHeader.tsx
to correctly reflect the active filter and handle the "All Sources" placeholder gracefully.
Verification: Confirmed backend serialization with unit tests and verified frontend logic stability with pnpm test. Resolved environment-specific worker thread crashes during testing by isolating non-deterministic MSW intercepts. @bbovenzi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:API Airflow's REST/HTTP API area:ConfigTemplates area:UI Related to UI/UX. For Frontend Developers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add option for default log_source setting in task logs web UI

2 participants