Katman MQTT Client
Loading account

MQTT Logging with Katman: Capture Topics to Text and CSV

Log selected MQTT topics to separate text or CSV files with the Katman MQTT client. Learn how desktop log rotation works and troubleshoot missing messages.

By Katman

A live MQTT message table is useful while a problem is happening. A log file is useful afterward: you can inspect the messages, compare them with another system's events, or share a small sample with the person investigating the device.

Katman's Topic logging workspace captures incoming messages from selected topics into text or CSV files. In the desktop app, each topic gets its own file in a folder you choose. You can stop one topic while the others continue, or split a longer capture into smaller files by size or time.

Suppose a device occasionally reports an unexpected temperature and then goes offline. Logging its temperature and status topics lets you keep both streams for comparison after the event. This guide walks through that investigation and explains what Katman writes to disk.

A subscribed Katman connection writes separate temperature and status CSV files into the chosen folder.

How Topic logging works

There are three steps between a device publishing and a row appearing in a log:

  1. Your connection receives a message through an MQTT subscription.
  2. Topic logging checks whether that exact topic is actively being logged.
  3. The desktop writer appends the message to that topic's file in your chosen folder, creating a file when its first message arrives.

Selecting a logging topic does not create a broker subscription. Set up the subscription on the connection first. The log captures incoming deliveries from that point onward; it does not copy the older messages in the live table.

For a first capture, connect and subscribe, open LOGGING, choose CSV and SINGLE FILE, select a destination folder, then add one exact topic. Check that its status says LOGGING before publishing your test message.

Decide which topics to capture

Connect Katman to the broker used by your test devices. Make sure your connection is subscribed to the topics you want to investigate and has permission to receive them. Logging can only save messages delivered to the client.

For a temperature investigation, you might choose:

lab/device-01/temperature
lab/device-01/status

The logging workspace accepts exact topic names. An MQTT subscription filter such as lab/+/temperature can help the connection receive messages, but it is not an exact topic to add to this logging list. Select the individual discovered topics or enter their names manually.

Choose a small, relevant set of topics first. This makes the resulting files easier to inspect and keeps unrelated traffic out of the investigation.

Select CSV and an output folder

Open LOGGING in the toolbar. Under LOG FILES, select CSV and leave the partition choice on SINGLE FILE for a short investigation.

Choose the destination with CHOOSE FOLDER. Katman remembers that folder for later sessions. If topics are already selected, choosing the folder can start logging them, so confirm the topics and format before making the selection.

For multiple selected topics, SINGLE FILE means one file per topic. It does not combine every topic into one shared CSV. File names incorporate a sanitized topic name and a hash so different topics can have separate destinations.

Format and partition choices are locked while capture is active. Stop the active topics before changing those settings or choosing a different folder. Katman's initial format is TEXT, so explicitly select CSV if you want structured rows.

Start capturing incoming messages

Add an exact topic manually or select it from the searchable discovered-topic list. With a destination available, adding a topic starts its capture. Each topic also has a control to stop and start it independently.

When viewing a selected exact topic in the message workspace, its LOG toggle offers a shortcut to add or remove that topic from the active log. If no default folder is configured, Katman directs you to the logging workspace first.

Capture begins from this point forward. Starting a log does not copy older messages from the table into the new file.

To generate a small test sample, publish these messages to your test broker:

Topic:   lab/device-01/temperature
Payload: {"temperature":21.4,"unit":"C"}

Topic:   lab/device-01/status
Payload: {"state":"online"}

With Mosquitto's command-line client installed, the first message can be sent like this. This example uses a local test broker listening on loopback port 18894; replace the address and connection settings with those of your own test broker.

mosquitto_pub -h 127.0.0.1 -p 18894 -V mqttv5 -q 1 \
  -t lab/device-01/temperature -m '{"temperature":21.4,"unit":"C"}'

The command uses Bash quoting. Publish a second temperature value, such as 21.6, so you can confirm that the same topic file receives another row.

Send the status message to the same test broker:

mosquitto_pub -h 127.0.0.1 -p 18894 -V mqttv5 -q 1 \
  -t lab/device-01/status -m '{"state":"online"}'

Watch the per-topic message counts in ENABLED TOPICS. After one send to each topic, each count should increase, and OPEN FOLDER should show two separate CSV files. If you send the second temperature value, its count should increase without changing the status count.

You can send them from another client or create reusable messages with Publish Templates. A log records incoming deliveries. If you publish from Katman, your connection must also receive the broker's delivery on that topic for it to appear in the topic log. A successful outgoing publish alone does not create an incoming log row.

Choose TEXT or CSV

Both formats create separate files for each topic in the desktop app:

Format Contents Useful when
TEXT Timestamp, topic, QoS, and payload separated by tabs You want to read simple, single-line messages in a text editor
CSV Named columns for timestamp, topic, QoS, retained flag, and payload You want to filter rows, compare values, or load the log into a CSV reader

TEXT does not include the retained flag. For payloads containing line breaks or tabs, prefer CSV: its quoting preserves the field boundaries when read with a CSV parser.

Read the CSV output

Native topic CSV logs use these columns:

Column Meaning
timestamp The message timestamp recorded by Katman
topic The exact MQTT topic
qos The incoming message's QoS
retained Whether the incoming delivery carried the retained flag
payload The logged payload representation

For example, this is the temperature CSV produced by the native logging service in our controlled broker test:

"timestamp","topic","qos","retained","payload"
"2026-11-12T09:04:36.197Z","lab/device-01/temperature","1","false","{""temperature"":21.4,""unit"":""C""}"
"2026-11-12T09:04:36.217Z","lab/device-01/temperature","1","false","{""temperature"":21.6,""unit"":""C""}"

The timestamps will differ in your capture. The doubled quotes inside the payload are CSV escaping: a CSV reader reconstructs the original JSON text. The status topic was written into a different file, rather than being mixed into these rows.

Use OPEN FOLDER to inspect the files. A CSV reader handles delimiters, quotes, and multiline payloads correctly; avoid splitting CSV rows manually on commas.

Native topic logs use UTF-8 text for valid text payloads, with tagged base64: text as a fallback for invalid UTF-8. CSV output uses spreadsheet-safe escaping: formula-leading values receive an apostrophe prefix. That protection can change the exported text, so do not treat these CSV files as an exact binary archive. Topic logs do not include every MQTT 5 property.

If you need to select additional metadata columns or choose a different payload representation, use the separate message-table export workflow.

Stop a topic without removing its configuration

Use the topic's stop control when you have enough evidence. Stopping the final active topic stops the logging session. Removing a topic also stops it when it is active, and removes it from the saved logging list.

Saved topic choices are associated with the connection. Restoring those choices after reopening Katman does not automatically resume capture. Start the topics you want to log again and confirm their LOGGING status.

An enabled topic can show STOPPED, meaning it is saved but not currently capturing. In the desktop app, FOLDER NOT SET means you must choose a destination before capture can start. Use the play control to restart a stopped topic; the remove control deletes it from the saved list as well.

Rotate longer captures by size or time

Select the partition setting under LOG FILES before starting a desktop capture:

Setting Behavior Example
SINGLE FILE Keep one file per topic for the session A short commissioning test
BY FILE SIZE Start a numbered part when the next row would exceed the selected size Split a busy temperature topic at 100 MB
BY TIME Start a numbered part on the next message after the selected interval has elapsed Split an investigation into 60-minute parts

Size accepts 1–10,240 MB; time accepts 1–10,080 minutes. Their initial values are 100 MB and 60 minutes. The size setting uses 1,024 × 1,024 bytes per MB.

Each topic rotates independently. A busy temperature topic can advance to its next part while a quiet status topic remains in its first file. Numbered files end in names such as -part-0001.csv and -part-0002.csv.

Time rotation is checked when a message arrives, using the elapsed time since that topic's current file opened. It does not align files to clock hours or create empty files while a topic is idle. Size rotation keeps a message row together, so a single oversized row can exceed the chosen size.

Splitting files makes them easier to handle, but does not cap the total disk space used by the investigation. Keep an eye on available storage.

Choose logging or table export

Need Use
Capture future incoming messages continuously Topic logging
Save a selection of messages already shown in the table Table export
Save traffic for later replay into a broker Record / Replay

The live message table has retention limits. Keeping the table open is not a substitute for starting a log when you need a file for later investigation.

Logging in a browser workspace

The browser workspace also supports topic logs, but keeps them in a bounded in-tab buffer for download. It does not stream files to the desktop output folder or provide desktop file rotation. Download the captured files before closing or reloading the tab.

Browser Topic logging showing two captured temperature messages with that topic stopped, while the status topic continues logging.

This screenshot shows the browser workspace, including its DOWNLOAD CSV control. The desktop workflow described above uses a destination folder instead.

The browser buffer holds up to 50,000 log lines and 20 MiB, dropping older lines when either limit is exceeded. Its message count can therefore be larger than the number of messages left to download. Browser output uses the browser's message representation, which may differ from original payload bytes for large messages. Use desktop logging when you need ongoing files on disk.

Check missing messages before extending a capture

If a topic file is empty or missing expected data, check:

  1. The connection is receiving that exact topic and has the necessary subscription and broker permissions.
  2. Logging is active for the topic, not merely saved in the configuration.
  3. The messages were sent after logging started.
  4. The selected output folder is writable and has free space.
  5. Katman is not reporting capture gaps, storage backlog, or writer failures.

Storage and memory are finite. A stalled writer or full queue can make a capture incomplete, so include any reported gaps when interpreting the file.

The Free plan supports three logged topics; Pro removes that product topic quota. See plan details for current limits. Filesystem and runtime limits still apply to either plan.

Download Katman MQTT, start with one topic, and inspect a known message in its output file. Add the other topics needed for your investigation once that first capture is working. To generate repeatable test traffic, follow the Publish Templates guide.

How this example was checked

On 12 November 2026, we connected Katman's native MQTT and logging services from an isolated test harness to Mosquitto 2.0.22 over loopback MQTT 5. An independent publisher sent QoS 1 messages. The native service wrote two files with two rows each, excluded messages sent before capture, and continued logging status after temperature capture stopped. No gaps, drops, or write failures were reported in that small test; this does not establish lossless capture under other loads.

We also exercised the browser workspace with a separate loopback WebSocket connection, checked its CSV downloads and exact-topic validation, and captured the screenshot above. Both checks used the 1.0.1 source workspace at commit 26f13ee. The native test did not exercise the desktop folder picker, file rotation, or the released Linux installer.

The workspace controls, file formats, rotation rules, browser buffer limits, and plan limits described here were rechecked against the 1.0.2 source workspace at commit 6bd71d8 on 16 November 2026. This source review did not repeat the runtime checks or test a distributed installer.