Airflow 2.0.1 : Write logs in Local Timezone

Viewed 513

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: Asia/Kolkata

AIRFLOW__CORE__DEFAULT_TIMEZONE: Asia/Kolkata

enter image description here

1 Answers

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

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

TZ=Asia/Kolkata

or

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
...

Hope that works for you!

Related