【发布时间】:2022-08-17 20:57:35
【问题描述】:
import os
import logging
from flask.appbuilder.security.manager import AUTH_OAUTH
from airflow.www.security import AirflowSecurityManager
AUTH_TYPE = AUTH_OAUTH
AUTH_ROLES_SYNC_AT_LOGIN = True
AUTH_USER_REGISTRATION = True
log = logging.getLogger(__name__)
log.setLevel(os.getenv(\"AIRFLOW__LOGGING__FAB_LOGGING_LEVEL\", \"INFO\"))
OAUTH_PROVIDERS = [
{
\"name\": \"egast\",
\"icon\": \"fa-address-card\",
\"token_key\": \"access_token\",
\"remote_app\": {
\"client_id\": \"<id>\",
\"client_secret\": \"<secret>\",
\"client_kwargs\": {
\"scope\": \"<scope>\",
\"grant_type\": \"authorization_code\",
},
\"access_token_method\": \"POST\",
\"access_token_params\": {
\"client_id\": \"<id>\",
},
\"request_token_url\": None,
\"api_base_url\": \"<url>\",
\"access_token_url\": \"<url>/token.oauth2\",
\"authorize_url\": \"<url>/authorization.oauth2\"
}
}
]
class CustomSecurityManager(AirflowSecurityManager):
def oauth_user_info(sm, provider, response=None):
if provider == \"egast\":
me = sm.oauth_remote[provider].get(\"userinfo\")
log.debug(me.data)
logging.info(me.data)
logging.debug(me.data)
print(me.data)
else:
log.debug(\"Nothing!!\")
logging.info(\"Nothing!!\")
logging.debug(\"Nothing!!\")
print(\"Nothing!!\")
SECURITY_MANAGER_CLASS = CustomSecurityManager
AUTH_ROLES_MAPPING = {
\"FAB_USERS\": [\'User\'],
\"FAB_ADMINS\": [\'Admin\']
}
我正在尝试将 oauth 集成到 Airflow 中,并且我有一个 CustomSecurityManager 类,我正在其中打印或记录一些要调试的语句。在 /home/airflow/airflow/ 下生成了几个日志文件,例如 airflow.cfg、webserver.log、webserver.out、scheduler.log 等。但它们都不包含这些 webserver_config.py 日志。那么,启动 Airflow 网络服务器和调度程序后,我究竟在哪里可以找到这些日志?