pushpendu91 commented on issue #41409:
URL: https://github.com/apache/airflow/issues/41409#issuecomment-2292031164

    Even though we can add below code for example in the set method to add 
audit log for variable creation from DAG and it is working fine as shown in the 
screenshot, but without proper dag_id, owner etc. it does not makes sense. And 
because airflow.models.variable does not have dag or dagrun context it is 
difficult to get the dag_id, task_id, run_id, owner etc. details to be logged. 
If community agrees we can add these details for set, update and delete method 
for Variables.
   
   `session.add(
               Log(
                   event="variable.create",
                   dag_id="",
                   owner="scheduler",
                   owner_display_name="Scheduler",
                   extra=f"key={key}, val={stored_value}, 
description={description}",
               )
           )`
   
   ![Screenshot 2024-08-16 at 12 46 27 
AM](https://github.com/user-attachments/assets/c24954c5-4190-43d7-b261-a897983b8742)
   


-- 
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]

Reply via email to