karenbraganz opened a new issue, #41409: URL: https://github.com/apache/airflow/issues/41409
### Apache Airflow version 2.9.3 ### If "Other Airflow 2 version" selected, which one? _No response_ ### What happened? If an Airflow variable is created, updated, or deleted from a task using Variable.set(), Variable.update(), or Variable.delete() methods, these events do not appear in the audit log. On the other hand, if a variable is created, updated, or deleted directly in the UI, these events appear in the audit logs. ### What you think should happen instead? Create, update, and delete events for Airflow variables should appear in audit logs even if they are triggered from a task. After reviewing [this PR](https://github.com/apache/airflow/pull/24079/files), I think this can be fixed by adding the `@action_logging` decorator to the set(), update(), and delete() methods in airflow.models.Variable. I'm not sure if this is the correct solution or if other changes will also need to be made. ### How to reproduce 1. Create a DAG containing a task with one or all of these methods: - Variable.set() - Variable.update() - Variable.delete() 2. Trigger a DAG run and let it complete. 3. Check the cluster audit logs for events relating to variable creation, updates, or deletion. These only appear if the changes are made directly on the UI. ### Operating System MacOS ### Versions of Apache Airflow Providers _No response_ ### Deployment Astronomer ### Deployment details Tested on Astro CLI ### Anything else? _No response_ ### Are you willing to submit PR? - [ ] Yes I am willing to submit a PR! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
