Does Heroku support a per‑dyno time zone setting for platform‑generated logs and scheduler events?
0 reputation · 20 Jan 2022, 01:27 UTC
0 reputation · 20 Jan 2022, 01:27 UTC
Determine whether the Heroku platform provides a built‑in mechanism to assign a regional time zone to individual dynos so that timestamps in platform‑emitted data such as logs, metrics, and scheduler runs reflect that zone instead of UTC.
Heroku dynos run with the system clock set to UTC and the platform does not apply a regional offset by default. Timestamp handling is delegated to the application, which must store dates in UTC and perform any user‑local conversion in code. There is no documented feature that automatically converts platform logs or scheduler timestamps based on a dyno‑level TZ environment variable, and it is unclear whether setting TZ affects those platform‑generated timestamps.
Specific questions:
35275 reputation · 20 Jan 2022, 13:21 UTC
No. Heroku does not provide a per-dyno time zone setting for platform-generated logs, metrics, or Scheduler events. Those timestamps are emitted in UTC, and no documented feature rewrites them based on a dyno-level TZ value.
Confirmed: Dyno containers run with the system clock in UTC. Config vars are application-wide, not scoped to individual dynos. Logplex, router logs, and platform metrics are produced outside your application process and are timestamped in UTC.
Likely explanation: A TZ config var is an ordinary environment variable. It can affect your own process if the runtime and installed tzdata honor it, but it does not reach platform components. Heroku Scheduler runs one-off dynos under the app config; a schedule time-zone selection, if available, controls when a job fires, not the time zone of the platform log or metric timestamps it produces.
Confirm the dyno clock remains UTC and that TZ changes only the app environment:
heroku run date -u
heroku run bash -c 'echo "$TZ"; date'
After setting TZ, trigger a Scheduler job and inspect heroku logs or a drain. Platform timestamps should remain UTC. Because platform behavior can change, verify against the current Heroku Scheduler and Logplex documentation before relying on any time-zone assumption.
Use comments to ask for clarification. Post a solution as an answer.
6,950 reputation · 20 Jan 2022, 03:25 UTC
Heroku’s platform emits all log lines, metrics, and scheduler events with timestamps in UTC. These values are generated by the platform itself, not by the dyno processes. Consequently, setting a TZ config var (e.g., TZ=America/New_York) does not alter the time zone of the platform‑generated timestamps.
If you need region‑specific times in your logs or scheduler output, perform the conversion in your application code or use a log‑drain service that applies a time‑zone offset during ingestion.
# Example in Ruby
utc_time = Time.now.utc
local_time = utc_time.in_time_zone("America/New_York")
puts "Log: #{local_time}"