Problem
Log timestamps in the admin Logs tab show UTC time instead of the user's configured timezone. For example, at 14:59 CEST (Europe/Zurich, UTC+2) the log shows 12:59:00.
Root cause
_BufferHandler.emit() at admin.py:456 formats timestamps using the system's local timezone:
"time": datetime.fromtimestamp(record.created).strftime("%H:%M:%S"),
datetime.fromtimestamp() without a tz argument uses the system/process timezone, which in Docker is typically UTC. The user's configured timezone is stored in the agent config (config.agent.timezone, default "Europe/Zurich") and is also editable via the You tab in the admin UI, but the log handler never reads it.
Affected area
- Logs tab (
/partials/logs-content): every log line's time field is formatted in UTC
- The
ts field (record.created) stores the correct UTC Unix timestamp, so the data is not lost — it's purely a display-time conversion issue
Proposed fix
In _BufferHandler.emit(), resolve the configured timezone and use it for formatting:
from zoneinfo import ZoneInfo
# Resolve the user's timezone (agent config, fallback UTC)
tz_name = "UTC"
if agent_state and agent_state.agent and agent_state.agent.config:
tz_name = getattr(agent_state.agent.config.agent, "timezone", None) or tz_name
"time": datetime.fromtimestamp(
record.created, tz=ZoneInfo(tz_name)
).strftime("%H:%M:%S"),
Alternatively, the timezone can be read from config_store.get("agent.timezone") if agent_state is unavailable (e.g. during startup before the agent is initialised).
Acceptance criteria
Problem
Log timestamps in the admin Logs tab show UTC time instead of the user's configured timezone. For example, at 14:59 CEST (Europe/Zurich, UTC+2) the log shows
12:59:00.Root cause
_BufferHandler.emit()atadmin.py:456formats timestamps using the system's local timezone:datetime.fromtimestamp()without atzargument uses the system/process timezone, which in Docker is typically UTC. The user's configured timezone is stored in the agent config (config.agent.timezone, default"Europe/Zurich") and is also editable via the You tab in the admin UI, but the log handler never reads it.Affected area
/partials/logs-content): every log line'stimefield is formatted in UTCtsfield (record.created) stores the correct UTC Unix timestamp, so the data is not lost — it's purely a display-time conversion issueProposed fix
In
_BufferHandler.emit(), resolve the configured timezone and use it for formatting:Alternatively, the timezone can be read from
config_store.get("agent.timezone")ifagent_stateis unavailable (e.g. during startup before the agent is initialised).Acceptance criteria
tsfield (Unix timestamp) is unaffected — it remains UTC for internal use