setting up s3 for logs in airflow

后端 未结 7 1435
后悔当初
后悔当初 2020-11-27 05:50

I am using docker-compose to set up a scalable airflow cluster. I based my approach off of this Dockerfile https://hub.docker.com/r/puckel/docker-airflow/

My problem

相关标签:
7条回答
  • 2020-11-27 06:37

    To complete Arne's answer with the recent Airflow updates, you do not need to set task_log_reader to another value than the default one : task

    As if you follow the default logging template airflow/config_templates/airflow_local_settings.py you can see since this commit (note the handler's name changed to's3': {'task'... instead of s3.task) that's the value on the remote folder(REMOTE_BASE_LOG_FOLDER) will replace the handler with the right one:

    REMOTE_LOGGING = conf.get('core', 'remote_logging')
    
    if REMOTE_LOGGING and REMOTE_BASE_LOG_FOLDER.startswith('s3://'):
            DEFAULT_LOGGING_CONFIG['handlers'].update(REMOTE_HANDLERS['s3'])
    elif REMOTE_LOGGING and REMOTE_BASE_LOG_FOLDER.startswith('gs://'):
            DEFAULT_LOGGING_CONFIG['handlers'].update(REMOTE_HANDLERS['gcs'])
    elif REMOTE_LOGGING and REMOTE_BASE_LOG_FOLDER.startswith('wasb'):
            DEFAULT_LOGGING_CONFIG['handlers'].update(REMOTE_HANDLERS['wasb'])
    elif REMOTE_LOGGING and ELASTICSEARCH_HOST:
            DEFAULT_LOGGING_CONFIG['handlers'].update(REMOTE_HANDLERS['elasticsearch'])
    

    More details on how to log to/read from S3 : https://github.com/apache/incubator-airflow/blob/master/docs/howto/write-logs.rst#writing-logs-to-amazon-s3

    0 讨论(0)
提交回复
热议问题