Display owner_display_name in Audit Log - #68833
Conversation
1514d84 to
d3ae2ec
Compare
There was a problem hiding this comment.
Thanks for the pull request.
CI need fixing (e2e tests).
Also I'm not sure about this, because there are plenty of other Log creation path and most of them do not populate the owner_display_name field. _add_log, task execution events, task fail/skip/running, scheduler events (scheduler_job_runner.py), buffered task events, asset events.
I'm afraid that showing this will highlight an inconsistent attribute. (None most of the time, unless it's created by the API layer). I wouldn't show this to the UI users unless we fix all the event creation path to properly populate the owner_display_name attribute.
d3ae2ec to
6fd3507
Compare
|
Thanks, I agree that showing the raw stored I’ll adjust the PR so UI column = log.owner_display_name OR user lookup from log.owner OR log.owner |
6fd3507 to
6670dc7
Compare
pierrejeambrun
left a comment
There was a problem hiding this comment.
A few things to address below
6670dc7 to
88661f8
Compare
cdc16c8 to
07333fb
Compare
|
rebased from the main branch for the latest CI fix |
amoghrajesh
left a comment
There was a problem hiding this comment.
Needs some more work.
|
Hello @VladaZakharova, will you be able to take a look at the comments? I have rebased it. |
Return the display name recorded when the action was logged and fall back to the raw owner, rather than recomputing it from the current viewer — an audit entry's owner should not change depending on who reads it. Keep it in the existing owner column instead of adding a second one.
Backport failed to create: airflow-ctl/v0-1-test. View the failure log Run detailsNote: As of Merging PRs targeted for Airflow 3.X In matter of doubt please ask in #release-management Slack channel.
You can attempt to backport this manually by running: cherry_picker 48dc012 airflow-ctl/v0-1-testThis should apply the commit to the airflow-ctl/v0-1-test branch and leave the commit in conflict state marking After you have resolved the conflicts, you can continue the backport process by running: cherry_picker --continueIf you don't have cherry-picker installed, see the installation guide. |
amoghrajesh
left a comment
There was a problem hiding this comment.
owner and owner_display_name are both set from the same user.get_name() call in https://github.com/apache/airflow/blob/main/airflow-core/src/airflow/api_fastapi/logging/decorators.py#L87-L164. So they will always be identical, no path where they diverge. Been true since owner_display_name was added, so this will not work.
|
I think we need a follow up PR, working on that. |
* Show user display name in the audit log via get_display_name The audit log's owner_display_name always equalled owner because the action logger stored get_name() in both fields. Add a get_display_name() to the auth manager user model, defaulting to get_name() so auth managers written before it keep working unchanged, and have the FAB user return its full name. The action logger now records get_display_name() as owner_display_name, so the audit log can show a friendlier name than the raw owner identifier where one exists. Follow-up to #68833. * Add an owner display name filter to the audit log The audit log user column now shows owner_display_name, so its filter should match that value. Add server-side pattern and prefix-pattern search params on owner_display_name and point the existing User filter at them, and drop the redundant UI owner fallback so the displayed value and the filter stay in sync. * Use spec on the mocked request and session in the decorator test * Use a real request instead of a mock in the decorator test A real Request built from a minimal ASGI scope supplies genuine empty headers/query/path params, so nothing needs stubbing and the test cannot drift from the real request interface. The session stays a spec'd mock to capture the logged row.
|
@pierrejeambrun |
In Breeze / community Airflow, there are several types of auth managers that have different sets of fields, which actually leads to different data stored to DB about the user.
The default auth manager is usually SimpleAuthManager. It only knows simple login data like:
For example:
username: admin
role: admin
password: admin
So in default Breeze, the new column will look the same as old one:
User: admin.
User Display Name: admin.
The other one that can be also used is FAB manager. Available fields are:
The common solution will be for different auth managers like this:
Example:
first_name = Jane.
last_name = Smith.
email = jane@example.com.
username = jane.
User = jane.
User Display Name = Jane Smith.
Or:
first_name = empty.
last_name = empty.
email = jane@example.com.
username = jane.
User = jane.
User Display Name = jane@example.com.
This change will make the Audit log more informative for users.

Example how it will look like:
The change is implemented as a new Column in Audit Logs tab, which can be also hidden in side menu by user, if preferred to not be shown.
Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.Was generative AI tooling used to co-author this PR?
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.Important
🛠️ Maintainer triage note for @VladaZakharova · by
@potiuk· 2026-07-11 14:59 UTCHelpful heads-up from the maintainers — please address before this PR can be reviewed (see our Pull Request quality criteria):
The ball is in your court — you've been assigned to this PR. Fix the above, then mark it Ready for review.
Automated triage — may be imperfect; a maintainer takes the next look.