About timezones¶
This page explains how KX Sensors uses UTC and server timezones for timeseries data, logging, and EOD, and how to set a local timezone.
KX Sensors uses the following timezones:
UTC¶
- KX Sensors stores all timeseries data timestamps in UTC.
- Unless you configure otherwise, v3 uses UTC in application log outputs. (v2 used the server timezone.)
- SAPI clients generate SAPI header values using the server timezone of the machine hosting the client, but KX Sensors then converts the times to UTC.
- Unless you configure otherwise, KX Sensors uses UTC to set the EOD time.
Server timezone¶
- If configured, KX Sensors can use the server timezone to set the EOD time. To enable this, set
eodTimeLocaltotrueinsystemParams.yaml. - If configured, KX Sensors can use the server timezone in application log output. To enable this, set
KXS_LOG_TSin thekxsenvfile.
Tip
Set EOD to midnight in the server timezone, whether that's UTC or a different local timezone, to minimize messages being processed as late data.
Set the server timezone to UTC to use it uniformly across all the points above. Also set the same server timezone on machines hosting the Sensors nodes and machines hosting external SAPI clients.
Set the server timezone to a local timezone¶
In some cases, you may prefer to set the server timezone to a local timezone rather than UTC. If you don't use UTC, configure a timezone that doesn't observe daylight saving time (DST). A timezone with DST causes duplicate timestamps and timestamp gaps within application logs, a shift in EOD time, and so forth.
If the desired local timezone doesn't observe DST, you can configure the server with that timezone directly. If it does observe DST, use a fixed offset variant of that timezone instead. See the following example.
Fixed offset timezone example for a server in Salem, Oregon¶
In Salem, the desired timezone is the Pacific timezone. During standard time, the offset is UTC-8; during Daylight Saving Time, the offset is UTC-7. As a compromise, you can set the server to use UTC-8. The effect is that the server is in local time during standard time, and off by one hour during DST.
The tz database option for UTC-8 is Etc/GMT+8.
Note
To conform with the POSIX style, zone names beginning with Etc/GMT have their sign reversed from the standard ISO 8601 convention. See the tz database for more information.
Use the following command for this example:
sudo timedatectl set-timezone Etc/GMT+8