Logger output to NervesHub, where it is stored against the device and can be searched.
Requirements
nerves_hub_link2.13.0 or later. The extension is in early release and is not in the default extension list.- NervesHub 2.3.0 or later for one line per message. NervesHub 2.5.0 or later for batched sending.
- ClickHouse on the instance. Without it, NervesHub does not offer the extension to devices and nothing is stored. See Feature prerequisites.
Enable it
1
Add Logging to your firmware
Name the module in
extension_modules:2
Turn it on for the product
In Product settings, on the General tab, switch on Logging in the Device extensions card. A product created in the web UI starts with every extension on. A product created through the API or
nh starts with every extension off.3
Check the device setting
On the device’s Settings tab, Logging in the Extensions card is on by default.
Check that it works
Reconnect the device if it was connected before you turned Logging on. Open the device and select the Logs tab. Lines appear as the device sends them. With batched sending, expect the first lines up to a minute after the extension attaches. The tab tells you when something is off:Choose what is sent
Only:info and above are sent by default. Raise the level on metered connections:
Logger level is accepted, and :all sends everything the Logger level lets through.
Each line carries the metadata Logger attached to it. That is everything by default, including the pid of the process that logged and, on a crash, the reason and stacktrace. To send less, name the keys you want:
Batched sending
The extension has two versions. NamingNervesHubLink.Extensions.Logging registers both, and the device offers whichever your NervesHub has, preferring 0.1.0.
NervesHub limits how often a device may send, not how much each message carries. At one message per line, a device that logs fast loses lines to the limit. NervesHub drops messages over the limit without telling the device.
The batched version holds lines in a bounded buffer and reports what it had to drop:
Limits
- A single line longer than 8KB is cut short and marked.
- NervesHub accepts at most 100 lines in one batched message. It drops the rest and stores a line saying how many were dropped.
- Log lines are kept for 3 days. The period is fixed. See ClickHouse retention.
Read logs in the web UI
The device’s Logs tab shows the newest lines and adds new ones as they arrive. On NervesHub 2.5.1 and later you can use Search messages, filter by Level and Time, and scroll back up to 1000 lines.Read logs with the CLI
nh device logs prints the lines a device has sent. It needs an organization and product, from --org and --product or your CLI configuration.
Ctrl+C:
Only lines at these levels. Repeat the flag or separate levels with commas. Levels are matched exactly:
--level warning does not include error.Only lines whose message contains this text. The match ignores case and is literal, so
% and _ are not wildcards.Only lines at or after this time. Accepts an ISO 8601 timestamp (
2026-08-16T09:14:00Z) or an offset from now (30m, 2h, 3d).Only lines before this time. Accepts the same formats as
--since. It is exclusive, so you can pass the oldest timestamp of one page as the next --before. Cannot be used with --follow.desc for newest first, or asc for oldest first. Cannot be used with --follow, which always prints oldest first.Print the most recent lines, then keep printing new ones until interrupted. This polls the API. There is no streaming endpoint.
-o json flag for JSON output. A one-shot command prints a single array. With --follow, it prints one JSON object per line:
Read logs with the API
level, search, since, before, limit and order. An instance without ClickHouse answers 501. See the API overview.
Turning the extension off stops new lines arriving. Lines already stored stay readable until they expire.

