Skip to content

Logs

Logs help diagnose runtime issues in Device Agent creation, device access, chat control, IM access, voice, and vision workflows. You can inspect and filter records in the console, or read local log files directly.

Open the Logs Page

In the console sidebar, click Logs, or open /workspace/logs. The page has two main areas:

AreaPurpose
Log filesLists available log files, usually named like device-agent-2026-05-11.log.
Log recordsShows records from the selected file. The page loads the latest 200 records by default.

If the page shows that file logging is disabled, open Logging configuration in the top-right corner, enable file logging, and save. New records start writing to files after file logging is enabled; earlier history is not backfilled.

Logs page

Local Log Files

File logs are written to the logs subdirectory under the runtime home by default:

RuntimeDefault directory
Source checkout<repo>/.device_agent/logs
Installed production binary~/.device_agent/logs

Agent Gateway prints Runtime Home during startup. LOG_DIR=logs is resolved relative to that directory; if LOG_DIR is an absolute path, logs are written directly there. The directory name is .device_agent.

Same-day logs are split by size:

text
device-agent-2026-05-11.log
device-agent-2026-05-11.001.log
device-agent-2026-05-11.002.log

device-agent-YYYY-MM-DD.log is the first file for the day. After it exceeds LOG_MAX_SIZE_MB, new records continue in .001.log, .002.log, and later segments. The Logs page only lists files that match this naming pattern.

Log Record Format

Log files use JSON Lines. Each line is one complete JSON record.

json
{
  "time": "2026-05-11T05:20:12.123Z",
  "level": "info",
  "module": "MQTT",
  "msg": "device connected",
  "requestId": "req-...",
  "productId": "product-001",
  "deviceId": "device-001",
  "topic": "device-agent/product-001/device/device-001/out",
  "args": [{ "durationMs": 18 }]
}

Common fields:

FieldDescription
timeISO timestamp, always written in UTC.
leveldebug, info, warn, or error.
moduleBackend module that emitted the record, such as Gateway, HTTP, MQTT, Agent, Tools, Skills, Voice, NTP, or A2A-Channel.
msgLog message.
requestId / sessionId / traceIdConnect one request, conversation, or tool call.
namespace / productId / deviceId / topicLocate a tenant, device, or MQTT topic.
method / path / statusCode / durationMsHTTP or service-call context.
provider / toolModel provider, voice provider, or tool execution context.
args / errorExtra context and exception details, sanitized and truncated.

Fields whose names imply secrets, such as apiKey, authorization, cookie, password, secret, token, or privateKey, are written as [redacted]. Business data is not removed automatically, so check device IDs, topics, state values, and third-party user IDs before sharing logs.

Local Troubleshooting Commands

In a source checkout, run these from the repository root:

bash
ls -lh .device_agent/logs
tail -n 200 .device_agent/logs/device-agent-2026-05-11.log
jq 'select(.level == "error")' .device_agent/logs/device-agent-2026-05-11.log
jq 'select(.deviceId == "device-001") | {time, level, module, msg, topic}' \
  .device_agent/logs/device-agent-2026-05-11.log
jq 'select(.requestId == "req-...")' .device_agent/logs/device-agent-2026-05-11.log

The Logs page uses these local endpoints:

EndpointPurpose
GET /api/logs/filesList readable log files.
GET /api/logs/tail?file=device-agent-2026-05-11.log&lines=200Read records from the end of a file. lines is capped at 1000.
GET /api/logs/tail?file=device-agent-2026-05-11.log&before=<offset>Read earlier records. Use nextBeforeOffset from the previous response as before.
GET /api/logs/download?file=device-agent-2026-05-11.logDownload one log file.

View and Filter Records

After selecting a log file, use these controls to locate a problem:

ActionBest for
RefreshCheck new records after a device comes online, a command is sent, or a conversation finishes.
Show earlier recordsLoad older records when the latest 200 are not enough.
Filter by levelFocus on warn or error records.
Search messageSearch error keywords, platform names, MQTT topics, or model service responses.
Filter by moduleInspect a capability area such as MQTT, HTTP, Voice, Tools, or A2A.
Search request IDTrace one HTTP request, conversation, or tool call.
Search device IDInspect reports, commands, and responses for one device.

Each record can be expanded to show the full JSON payload. Use the copy button to share one entry, or the download button to export the selected log file.

Log Levels

LevelDescription
debugMost detailed. Use temporarily for difficult issues. It can generate many records.
infoRecommended default. Records startup, connections, requests, and main runtime status.
warnRecords issues that may affect behavior but do not always fail the workflow.
errorRecords failures and exceptions only.

For daily use, keep info. If a problem is hard to reproduce, switch to debug temporarily, reproduce the issue, then switch back to info.

Configure Logging

On the Logs page, click Logging configuration to adjust:

SettingPurpose
LevelControls how much information is recorded.
Console loggingWrites logs to the terminal where the service is running.
File loggingWrites logs to files that can be viewed and downloaded from the Logs page.
Log directoryWhere log files are stored. Relative paths are placed under the Device Agent data directory.
Max file sizeSplits a log file after it reaches the limit.
Retention daysRemoves old log files after the retention window.
Max total sizeRemoves older files first when all logs exceed the total size limit.
File date timezoneUses either system time or UTC when generating log file names.

Saved logging settings are written to local configuration. Matching .env values still override saved settings when the service starts.

Common .env settings:

bash
LOG_LEVEL=info
LOG_CONSOLE_ENABLED=true
LOG_FILE_ENABLED=true
LOG_DIR=logs
LOG_MAX_SIZE_MB=50
LOG_RETENTION_DAYS=14
LOG_MAX_TOTAL_SIZE_MB=1024
LOG_TIMEZONE=system

See Configuration for other configuration sources.

Common Troubleshooting Paths

IssueWhat to check
A device does not appear in the listSearch by device ID and confirm MQTT connection, online status, or telemetry reports.
Chat control does not take effectSearch by device ID or request ID to see whether a command was sent and whether the device responded.
An IM bot does not replySearch by module or platform name to inspect credentials, allow lists, message receiving, and reply delivery.
Voice recognition or playback failsFilter by voice-related modules and inspect voice service, session, and recognition records.
A tool or skill does not runFilter by tool-related modules and inspect tool loading, permissions, and execution results.
A model service returns an errorSearch by error or model provider name to inspect request failure, authentication failure, or timeout information.

Before downloading or sharing logs, check whether they include device IDs, topics, state values, third-party user IDs, or other sensitive business data. Common secret fields are redacted, but business data can still appear in log messages.