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

   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. 
   
   `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/55bdac42-36e3-4f5f-9193-49c605705d21)
   
   
   And because airflow.models.variable does not have dag or dagrun context it 
is not possible without some core code changes to get the dag_id, task_id, 
run_id, owner etc. details to be logged. If community agrees we can add these 
basic details(event, extra, owner=‘scheduler’ etc.) for set, update and delete 
method for Variables.
   


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