Skip to main content
Version: Next

Log Files

The logs that are useful for debugging thin-edge.io break down into logs that are created by thin-edge.io itself and by third party components.

thin-edge.io logs​

On a thin-edge.io device different components like mappers, agent, and plugins run. The log messages of these components can be accessed as below. The logs here capture INFO, WARNING, and ERROR messages.

Cloud mapper logs​

The thin-edge.io cloud mapper component that sends the measurement data to the cloud can be accessed as below.

Cumulocity mapper​

The log messages of the Cumulocity mapper component that sends the measurement data from the thin-edge.io device to the Cumulocity cloud can be accessed as below

journalctl -u tedge-mapper-c8y
note

Run tedge-mapper --debug c8y to log more debug messages

Azure mapper​

The log messages of the Azure mapper component that sends the measurement data from the thin-edge.io device to the Azure cloud can be accessed as below.

journalctl -u tedge-mapper-az
note

Run tedge-mapper --debug az to log more debug messages

AWS mapper​

The log messages of the AWS mapper component that sends the measurement data from the thin-edge.io device to the AWS cloud can be accessed as below.

journalctl -u tedge-mapper-aws
note

Run tedge_mapper --debug aws to log more debug messages

Device monitoring logs​

The thin-edge.io device monitoring component logs can be found as below

Collectd mapper logs​

The log messages of the collectd mapper that sends the monitoring data to the cloud can be accessed as below

journalctl -u tedge-mapper-collectd
note

Run tedge-mapper --debug collectd to log more debug messages

Operations logs​

The agent creates a log file per operation execution, logging all the steps, sub-commands output and errors. This is done for all operations: software, config and firmware updates but also software or config list requests as well as any user-defined operation defined using a workflow.

These log files are stored in /var/log/tedge/agent.

  • This directory can be configured with tedge config set logs.path <tedge-log-directory>,
  • the agent sub-directory being created by the agent or tedge init.

Each log file is named after the command identifier as published over MQTT.

  • A software update command published on te/<device-id>/cmd/<command-name>/<cmd-id>
  • is monitored by the log file workflow-<command-name>-<cmd-id>.md
  • stored in the log directory of the agent running on the device <device-id>.

Over time, these log files are purged by the agent.

  • The default agent behavior is to keep a maximum of 5 log files per operation type.
  • This default can be configured using tedge config add logs.max_per_operation "*:4" where * stands for any operation, and the number is the new default (4 in that case).
  • A max log file count can be assigned specifically to an operation with tedge config add logs.max_per_operation "<operation-name>:<max-count>", for example software_list:1.
  • The default can be reset for an operation with tedge config remove logs.max_per_operation "<operation-name>"
  • The feature can be fully disabled with tedge config set logs.max_per_operation "" or enabled only for operations explicitly listed by removing the default maximum, i.e. running tedge config remove logs.max_per_operation "*".
  • Note that for these configuration updates to be effective, the agent must be restarted.

tedge-agent logs​

The agent service logs can be accessed as below

journalctl -u tedge-agent

For example: tedge-agent logs plugin calls finalize and list.

Logs
tedge-agent : TTY=unknown ; PWD=/tmp ; USER=root ; COMMAND=/etc/tedge/sm-plugins/apt finalize
tedge-agent : TTY=unknown ; PWD=/tmp ; USER=root ; COMMAND=/etc/tedge/sm-plugins/apt list
note

Run tedge-agent --debug to log more debug messages

Third-party component logs​

thin-edge.io uses the third-party components Mosquitto as the mqtt broker and Collectd for monitoring purpose. The logs that are created by these components can be accessed on a thin-edge.io device as below.

Mosquitto logs​

thin-edge.io uses Mosquitto as the mqtt broker for local communication as well as to communicate with the cloud. The Mosquitto logs can be found in /var/log/mosquitto/mosquitto.log. Mosquitto captures error, warning, notice, information, subscribe, and unsubscribe messages.

note

Set log_type debug or log_type all on /etc/mosquitto/mosquitto.conf, to capture more debug information.

Collectd logs​

Collectd is used for monitoring the resource status of a thin-edge.io device. Collectd logs all the messages at /var/log/syslog. So, the collectd specific logs can be accessed using the journalctl as below

journalctl -u collectd

Configuring log levels in thin-edge.io​

The log levels can be configured for thin-edge.io services using either by command line or setting the required log level in system.toml

Setting the log level through cli​

The log-level can be configured for a thin-edge.io service using the --log-level argument. For example for tedge-mapper:

sudo -u tedge -- tedge-mapper c8y --log-level debug 

The possible values for --log-level are trace, debug, info (the default), warn and error.

note

In a similar way it can be set for all the thin-edge.io services and the tedge CLI.

There is also a --debug argument, which is shorthand for --log-level debug.

Setting log level through system.toml​

The log levels can also be configured through the system.toml file. The supported log levels are info, warn, error, trace, debug.

file: /etc/tedge/system.toml
[log]
tedge-mapper = "trace"
tedge-agent = "info"
note

The log level strings are case insensitive