You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/01/13 04:29:13 UTC
[GitHub] [airflow] nirutgupta edited a comment on issue #20779: Logs of tasks when running is not available with kubernetesexecutor on webserver UI
nirutgupta edited a comment on issue #20779:
URL: https://github.com/apache/airflow/issues/20779#issuecomment-1011786738
k8s task handler.py which we can use https://gist.github.com/szeevs/938ad3cf96e732d4b1b55a74015aed5b
log_config.py will look like
```
from copy import deepcopy
from airflow.config_templates.airflow_local_settings import DEFAULT_LOGGING_CONFIG
from airflow.configuration import conf
import os
import sys
sys.path.append('/opt/airflow/custom_log')
BASE_LOG_FOLDER: str = conf.get('logging', 'BASE_LOG_FOLDER')
FILENAME_TEMPLATE: str = conf.get('logging', 'LOG_FILENAME_TEMPLATE')
LOGGING_CONFIG = deepcopy(DEFAULT_LOGGING_CONFIG)
LOGGING_CONFIG['handlers']['k8stask'] = {
'class': 'k8s_task_handler.KubernetesTaskHandler',
'formatter': 'airflow',
'base_log_folder': os.path.expanduser(BASE_LOG_FOLDER),
'filename_template': FILENAME_TEMPLATE
}
LOGGING_CONFIG['loggers']['airflow.task']['handlers'].append('k8stask')
```
Make sure while deploying configure this env
- name: AIRFLOW__LOGGING__LOGGING_CONFIG_CLASS
value: "log_config.LOGGING_CONFIG"
This will do the job. :)
--
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: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org