0
0
Apache Airflowdevops~10 mins

Audit logging in Apache Airflow - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable audit logging in Airflow's configuration file.

Apache Airflow
[logging]
audit_log_enabled = [1]
Drag options to blanks, or click blank then click option'
AFalse
BTrue
CNone
DAuto
Attempts:
3 left
💡 Hint
Common Mistakes
Setting audit_log_enabled to False disables audit logging.
2fill in blank
medium

Complete the code to specify the audit log file path in Airflow's configuration.

Apache Airflow
[logging]
audit_log_file = [1]
Drag options to blanks, or click blank then click option'
A/var/log/airflow/audit.log
B/home/user/airflow/dags
C/etc/airflow/airflow.cfg
D/tmp/airflow.log
Attempts:
3 left
💡 Hint
Common Mistakes
Using the DAGs folder or config file path as log file path.
3fill in blank
hard

Fix the error in the Airflow audit logging configuration line.

Apache Airflow
[logging]
audit_log_level = [1]
Drag options to blanks, or click blank then click option'
AINFO
BERRORS
CDEBUG
DWARN
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-standard log levels like ERRORS or WARN.
4fill in blank
hard

Fill both blanks to configure audit logging format and enable it.

Apache Airflow
[logging]
audit_log_format = "[1]"
audit_log_enabled = [2]
Drag options to blanks, or click blank then click option'
A%(asctime)s - %(user)s - %(action)s
BFalse
CTrue
D%(levelname)s - %(message)s
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic log formats or disabling audit logging.
5fill in blank
hard

Fill all three blanks to create a Python snippet that logs an audit event in Airflow.

Apache Airflow
from airflow.utils.log.logging_mixin import LoggingMixin
logger = LoggingMixin().log

def log_audit_event(user, action):
    logger.[1](f"User: [2], Action: [3]")
Drag options to blanks, or click blank then click option'
Ainfo
Buser
Caction
Ddebug
Attempts:
3 left
💡 Hint
Common Mistakes
Using debug level instead of info.
Not using the correct variable names.