algorand / algorand/go-algorand
The datetime reported in node.log is the local server time, not the UTC time.
- Lingua principale
- Go
- Stelle
- 1.4k
- Fork
- 537
- Merge medio
- 1g 6h
- PR unite (30g)
- 17
Descrizione
### Subject of the issue
Having observed node.log entries in several servers side-by-side, I see that the "time" element in the log is taken from the server's local time that is displayed when the command $ timedatectl is run, not the UTC time. For example, a server in Tokyo that has the local time set to the correct local timezone:
$ timedatectl
Local time: Sat 2022-12-03 01:07:32 JST
Universal time: Fri 2022-12-02 16:07:32 UTC
RTC time: Fri 2022-12-02 16:07:32
Time zone: Asia/Tokyo (JST, +0900)
displays this in the most recent log entry:
"time": "2022-12-03T01:05:47.127174+09:00"
whereas a server in another location that has the local time set to UTC:
$ timedatectl
Local time: Fri 2022-12-02 16:09:15 UTC
Universal time: Fri 2022-12-02 16:09:15 UTC
RTC time: Fri 2022-12-02 16:09:15
Time zone: Etc/UTC (UTC, +0000)
displays this in the most recent log entry:
"time": "2022-12-02T16:09:05.799981Z"
I suggest standardizing on the UTC time, or adding both "local time" and "UTC time" to the log entries, so they are easier to compare across multiple servers. Obviously this is more of an opinion than a bug, but as a database developer, we always record datetimes in UTC in a database, and if needed, also record a timezone offset. That is another approach that could work - record the "time" element as the servers "UTC" time, and then add a timezone offset element that shows the offset to the server's local time, such as "+09:00" for a server in Tokyo, or "-05:00" for a server in New York.
### Your environment
### Steps to reproduce
1. Run the command: $ timedatectl to see the local time setting on your server
2. Extract the most recent "time" element from node.log: $ tail -n 1 $ALGORAND_DATA/node.log | jq -R '. as $line | try(fromjson | .time) catch empty'
3. Observe that the "time" element in node.log will match the "Local time" of the server rather than the "Universal time"
### Expected behaviour
I suggest recording the logs uniformly in the Universal time, and adding an element to record the local timezone offset.
### Actual behaviour
Logs are recorded in the server's "Local time".
Guida per i contributori
Apri la guida per i contributori
Valutazione
Questa issue non è ancora stata valutata.