You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "humit0 (via GitHub)" <gi...@apache.org> on 2025/07/11 15:16:36 UTC
[D] Incorrect timezone display in task log view [airflow]
GitHub user humit0 created a discussion: Incorrect timezone display in task log view
### Apache Airflow version
3.0.2
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
The time field in the task logs displayed on the web interface is showing an incorrect timezone.
Although the default timezone is configured to KST (+09:00) and the web display is also set to KST, the times are being displayed in UTC. And log files are also recording in UTC.
web
<img width="1828" alt="Image" src="https://github.com/user-attachments/assets/a5f794e5-87d4-40b7-beda-dbc27af27353" />
log file
<img width="958" alt="Image" src="https://github.com/user-attachments/assets/d02a5f3a-6443-4058-897a-6dbf35578388" />
### What you think should happen instead?
### How to reproduce
## Configured environment variables
```shell
export AIRFLOW_HOME=/tmp/airflow
export AIRFLOW__CORE__LOAD_EXAMPLES=False
export AIRFLOW__CORE__DEFAULT_TIMEZONE=Asia/Seoul
```
## DAG
```python
from airflow.models import DAG
from airflow.providers.standard.operators.bash import BashOperator
default_args = {
"owner": "airflow",
"depends_on_past": False,
"start_date": "2023-01-01",
"retries": 1,
}
with DAG(
dag_id="test_dag",
default_args=default_args,
schedule="@once",
) as dag:
BashOperator(
task_id="test_task",
bash_command="echo '{{ ds }}'",
)
```
### Operating System
MacOS
### Versions of Apache Airflow Providers
apache-airflow-providers-amazon==9.8.0
apache-airflow-providers-apache-spark==5.3.0
apache-airflow-providers-celery==3.11.0
apache-airflow-providers-common-compat==1.7.0
apache-airflow-providers-common-io==1.6.0
apache-airflow-providers-common-sql==1.27.1
apache-airflow-providers-http==5.3.0
apache-airflow-providers-postgres==6.2.0
apache-airflow-providers-redis==4.1.0
apache-airflow-providers-smtp==2.1.0
apache-airflow-providers-standard==1.2.0
### Deployment
Virtualenv installation
### Deployment details
Running with `airflow standalone` command
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
GitHub link: https://github.com/apache/airflow/discussions/53195
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Incorrect timezone display in task log view [airflow]
Posted by "COKID (via GitHub)" <gi...@apache.org>.
GitHub user COKID added a comment to the discussion: Incorrect timezone display in task log view
> [@AryanK1511](https://github.com/AryanK1511) I set `default_timezone` [config](https://airflow.apache.org/docs/apache-airflow/3.0.2/configurations-ref.html#default-timezone) as "Asia/Seoul" instead of `default_ui_timezone` configuration.
>
> If i don't specify `default_timezone` option, then it works fine.
I have same problem when I set airflow.cfg 'default_timezone = Asia/Shanghai'
When rollback this config as default as "default_timezone = utc", all work well
I get logs using api when I set my timezone, the response contains "timestamp": "2025-07-02T06:16:24.681786+08:00”, It's weird;
When I rollback config and restart airflow, I got "timestamp": "2025-07-02T08:02:42.853339Z", That's correct
GitHub link: https://github.com/apache/airflow/discussions/53195#discussioncomment-13733133
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Incorrect timezone display in task log view [airflow]
Posted by "AryanK1511 (via GitHub)" <gi...@apache.org>.
GitHub user AryanK1511 added a comment to the discussion: Incorrect timezone display in task log view
> After removing `.replace(tzinfo=None)` in below code
>
> [airflow/task-sdk/src/airflow/sdk/execution_time/supervisor.py](https://github.com/apache/airflow/blob/7d00e452df66617e3e3a83f05fecf035f2896475/task-sdk/src/airflow/sdk/execution_time/supervisor.py#L1575)
>
> Line 1575 in [7d00e45](/apache/airflow/commit/7d00e452df66617e3e3a83f05fecf035f2896475)
>
> event["timestamp"] = msgspec.json.decode(f'"{ts}"', type=datetime).replace(tzinfo=None)
> then, task log display in correct timezone.
>
> <img alt="Image" width="1819" src="https://private-user-images.githubusercontent.com/8676247/458147984-b7b2c18c-14f3-4477-86df-fa214f4a3acb.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTEzMzAwOTIsIm5iZiI6MTc1MTMyOTc5MiwicGF0aCI6Ii84Njc2MjQ3LzQ1ODE0Nzk4NC1iN2IyYzE4Yy0xNGYzLTQ0NzctODZkZi1mYTIxNGY0YTNhY2IucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDcwMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA3MDFUMDAyOTUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZmJjNDAxMmRlNDcxYmJjYjY3NzY1OTA0MjA0ZjBkZGJiMDc3NmFlMGZhM2M0MjQ4ODU1ZDExZDcyMjQ0ZjA1MyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.6epwPTPEqGsoQzQ4x6rElrRaepnxsOXYccfDT_OMi2E"> <img alt="Image" width="1916" src="https://private-user-images.githubusercontent.com/8676247/458148261-3669c054-d86d-4b01-981e-ddbab3d73b06.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVC
J9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NTEzMzAwOTIsIm5iZiI6MTc1MTMyOTc5MiwicGF0aCI6Ii84Njc2MjQ3LzQ1ODE0ODI2MS0zNjY5YzA1NC1kODZkLTRiMDEtOTgxZS1kZGJhYjNkNzNiMDYucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDcwMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTA3MDFUMDAyOTUyWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzBiNGI1ODM1ODQ4MGQ4YWQzZGY4MTI4MDQ4Njk5OGEyMDlkMDZkYTlhZmYwMmQ4ZTkwMWM5NTUzMzUwMWQ2OSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.MQHzr8w2MS29XWWFXxMd0HeZsgtTHocCHmtictrrWbk">
I see, I'll try recreating this right now and then get back to you with further updates.
GitHub link: https://github.com/apache/airflow/discussions/53195#discussioncomment-13733130
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Incorrect timezone display in task log view [airflow]
Posted by "humit0 (via GitHub)" <gi...@apache.org>.
GitHub user humit0 added a comment to the discussion: Incorrect timezone display in task log view
After removing `.replace(tzinfo=None)` in below code
https://github.com/apache/airflow/blob/7d00e452df66617e3e3a83f05fecf035f2896475/task-sdk/src/airflow/sdk/execution_time/supervisor.py#L1575
then, task log display in correct timezone.
<img width="1819" alt="Image" src="https://github.com/user-attachments/assets/b7b2c18c-14f3-4477-86df-fa214f4a3acb" />
<img width="1916" alt="Image" src="https://github.com/user-attachments/assets/3669c054-d86d-4b01-981e-ddbab3d73b06" />
GitHub link: https://github.com/apache/airflow/discussions/53195#discussioncomment-13733129
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Incorrect timezone display in task log view [airflow]
Posted by "MizuyoruTW (via GitHub)" <gi...@apache.org>.
GitHub user MizuyoruTW added a comment to the discussion: Incorrect timezone display in task log view
I’m experiencing the same issue.
I’ve set `default_timezone = Asia/Taipei` in my `airflow.cfg`, and my container is also using this timezone (`/etc/localtime` and `/etc/timezone`).
For additional context, this problem is not only about the Web UI timezone. Here’s my situation:
* I always set my Web UI to UTC+8:
<img width="2000" height="957" alt="image" src="https://github.com/user-attachments/assets/db8ce61b-bf1d-4ea9-94f3-6169545ea3fa" />
* But if I change the Web UI to UTC+0:
<img width="2000" height="957" alt="image" src="https://github.com/user-attachments/assets/94582952-63f6-45cd-bb2b-7f249e7b3698" />
The timestamps in the logs are always 8 hours behind compared to other places.
GitHub link: https://github.com/apache/airflow/discussions/53195#discussioncomment-13746790
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Incorrect timezone display in task log view [airflow]
Posted by "AryanK1511 (via GitHub)" <gi...@apache.org>.
GitHub user AryanK1511 added a comment to the discussion: Incorrect timezone display in task log view
@humit0 I have an answer for you.
In the current state there is no direct config setting through the `airflow.cfg` file for the UI's Timezone.
**The `default_ui_timezone` configuration was removed** in [PR #49176](https://github.com/apache/airflow/pull/49176) as part of AIP-38. The UI now uses a simpler approach:
1. The UI automatically detects and uses the **system timezone** from the user's browser
2. Users can manually change their timezone preference through the UI's timezone selector.
3. The selected timezone is stored in the browser's `localStorage`, making it a per-browser setting
So, I setup airflow using the `airflow standalone` command just like you did. On the bottom right corner of your screen, you will see the user settings where you have the ability to set a timezone for the UI.
<img width="291" alt="Image" src="https://github.com/user-attachments/assets/704e210b-10c2-4a01-b4d3-6731edbf33eb" />
Checkout my example below with a DAG that I ran some time ago.
Here, I am using the UTC time zone.
<img width="1021" alt="Image" src="https://github.com/user-attachments/assets/a3e574e3-5662-4806-a084-74d829616436" />
However, as soon as I switch to America/Toronto, which is my timezone, the logs and the UI change as well.
<img width="977" alt="Image" src="https://github.com/user-attachments/assets/ef234d5d-badf-46f0-a42d-d6e95a2f72e6" />
I hope this answers your question. Lemme know if we can close this issue now.
GitHub link: https://github.com/apache/airflow/discussions/53195#discussioncomment-13733131
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Incorrect timezone display in task log view [airflow]
Posted by "labintsev (via GitHub)" <gi...@apache.org>.
GitHub user labintsev added a comment to the discussion: Incorrect timezone display in task log view
Airflow designed for users, that may live in more than one time zone.
> I always set my Web UI to UTC+8
- this is correct, UI in your local time, db logs in UTC.
> But if I change the Web UI to UTC+0
- this is not correct, db logs shifted to UTC-8:00, because you set `default_timezone = Asia/Taipei`
https://airflow.apache.org/docs/apache-airflow/stable/authoring-and-scheduling/timezone.html
GitHub link: https://github.com/apache/airflow/discussions/53195#discussioncomment-15838822
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Incorrect timezone display in task log view [airflow]
Posted by "humit0 (via GitHub)" <gi...@apache.org>.
GitHub user humit0 added a comment to the discussion: Incorrect timezone display in task log view
Hello @rawwar !
I was wondering if you could explain the reason for converting this issue into a discussion. It seems there might have been a mix-up regarding the settings. To be clear, my report was about `default_timezone`, not `default_ui_timezone`, which @Aryank1511 addressed.
GitHub link: https://github.com/apache/airflow/discussions/53195#discussioncomment-13746423
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Incorrect timezone display in task log view [airflow]
Posted by "humit0 (via GitHub)" <gi...@apache.org>.
GitHub user humit0 added a comment to the discussion: Incorrect timezone display in task log view
@AryanK1511
I set `default_timezone` [config](https://airflow.apache.org/docs/apache-airflow/3.0.2/configurations-ref.html#default-timezone) as "Asia/Seoul" instead of `default_ui_timezone` configuration.
If i don't specify `default_timezone` option, then it works fine.
GitHub link: https://github.com/apache/airflow/discussions/53195#discussioncomment-13733132
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Incorrect timezone display in task log view [airflow]
Posted by "AryanK1511 (via GitHub)" <gi...@apache.org>.
GitHub user AryanK1511 added a comment to the discussion: Incorrect timezone display in task log view
I can look into this one!
GitHub link: https://github.com/apache/airflow/discussions/53195#discussioncomment-13733128
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org