fluent-bit
fluent-bit copied to clipboard
How to change the default UTC timestamp on fluent-bit logs?
Bug Report
Describe the bug
The Fluent Bit Docker container is running as default UTC timestamp . But our server timezone is refer to different time zone(AEST ).
During the debug mode, it's difficult to understand the different between both timezone. Is there any another way to change the default UTC timezone according to system time zone?
Log
See different between both time zone
[Tue 09/08 09:18 PM] ec2-user@ip:~$ date Tue Aug 9 21:18:55 AEST 2022 [Tue 09/08 09:18 PM] ec2-user@ip:~$ kubectl logs fluent-bit | grep error [2022/08/09 11:18:11] [error] [output:cloudwatch_logs:cloudwatch_logs.0]
I want to know about this issue, too. Is the issue resolved?
@raj13aug @ym1085 I'm not part of the Fluent Bit team, but I might be able to help out here.
- This is not a Fluent Bit-specific issue -- by default, all Docker containers are set to UTC, and are not aware of the local host's time zone.
- As far I'm aware, it's considered best practice to stick to UTC everywhere, as that is the official time standard that all time zones are based off of, and it reduces confusion when your system spans multiple time zones. Eg. If part of your system is in AEST, part is in EST, part is in IST, etc., comparing logs from all of them will be a nightmare if the logs use the local time zone. Instead, if all your systems are set to use UTC, then all the logs can be easily compared regardless of where it came from. So, instead of changing your Docker container's time zone from UTC to AEST (your server's local time zone), I would recommend changing your servers from AEST to UTC.
- Regardless, if you're determined to change your Docker container's time zone to match the local host's time zone, this is how you can do it:
- On Linux machines, there is a file called
/etc/localtime
that controls the time zone. If you exec into the Docker container, you will see that that file is set to UTC, whereas the corresponding file on your host/server will be set to AEST. - So, to have the Docker container use the host's time zone, you just need to mount the host's
/etc/localtime
file (set to AEST) into your Docker container, so that it overwrites the corresponding file in your container (set to UTC). - For more details, see https://serverfault.com/questions/949686/docker-how-to-sync-date-between-a-centos-host-and-a-debian-container/990399#990399
- On Linux machines, there is a file called
This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 5 days. Maintainers can add the exempt-stale
label.
This issue was closed because it has been stalled for 5 days with no activity.