Airflow 2.0.1:在本地时区写入日志 [英] Airflow 2.0.1 : Write logs in Local Timezone

查看:19
本文介绍了Airflow 2.0.1:在本地时区写入日志的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

默认情况下,airflow 2.0.1 在 UTC 时区写入日志.但我希望日志以本地/机器 [非 UTC] 时区写入.我尝试在下面更改.但没有运气

By default, airflow 2.0.1 write logs in UTC timezone. But I want the logs to write in Local/Machine [non UTC] timezone. I tried changing below. But no luck

AIRFLOW__WEBSERVER__DEFAULT_UI_TIMEZONE:亚洲/加尔各答

AIRFLOW__CORE__DEFAULT_TIMEZONE:亚洲/加尔各答

推荐答案

您需要在 cointainers 中设置时区.为此,您可以传递环境变量 TZ.试试这个:

You need to set the timezone in the cointainers. To do so you could pass the environment variable TZ. Try this:

如果你有一个 .env 文件与 docker-compose.yaml 处于同一级别,请在其中添加以下行:

If you have an .env file at the same level of the docker-compose.yaml, add this line to it:

TZ=Asia/Kolkata

只需将其添加到 Airflow docker-compose 文件中 x-airflow-common 定义的环境中:

Simply add it to environment in x-airflow-common definition in the Airflow docker-compose file:

---
version: "3"
x-airflow-common: &airflow-common
  build: .
  image: ${AIRFLOW_IMAGE_NAME:-custom_img_name}
  environment: &airflow-common-env
    TZ: Asia/Kolkata
...

希望对你有用!

这篇关于Airflow 2.0.1:在本地时区写入日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆