2

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

Ganesh
  • 677
  • 8
  • 11

1 Answers1

4

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!

NicoE
  • 4,373
  • 3
  • 18
  • 33
  • 1
    Thank you so much. It worked. By the way, where do you find this `TZ` environment variable ? – Ganesh Apr 23 '21 at 03:38
  • 1
    Glad to hear that worked, thanks for the feedback! Please do remember to mark the answer as [accepted](https://stackoverflow.com/help/accepted-answer). Regarding `TZ`, is part of the variables that most Linux distributions include by default, check this [Ubuntu docs](https://help.ubuntu.com/community/EnvironmentVariables) with more details and examples. – NicoE Apr 23 '21 at 12:20