Skip to main content
Every Filetrace listing prints as a table for people and as JSON, JSON Lines or CSV for programs. Machine-readable formats carry exact byte counts instead of rounded sizes, RFC 3339 timestamps, and one schema for a transfer whether it comes from files or from events. This guide shows the common patterns: query, filter with jq, follow the stream, and react to exit codes.

Choose a format

--output <file> writes to a file instead of standard output. [output] format in the configuration file sets the default for every listing command. Output formats describes each format per command, and JSON output schema lists every field.

Read a transfer record

A record from filetrace files --jsonl, wrapped for reading:
transfer.bytes_sent is what the socket accepted from the file, file.size the size of the file when it was first seen, and, for read-write transfers, transfer.bytes_read what the thread read from it. incomplete is true when events were lost during the transfer.

Filter and aggregate with jq

Narrow the result with Filetrace’s own options, then shape it with jq.

Follow the event stream

filetrace events --follow --jsonl prints one JSON record per event as it happens, which suits a log shipper or a small daemon:
Each event carries the bytes of one collection interval, so a long transfer produces several events whose bytes_sent add up to the transfer. Event records have a sequence number that increases with every record. For a stream to another system, the OTLP exporter or the gRPC API are sturdier than a pipe.

Handle exit codes

Filetrace distinguishes an empty answer from an incomplete one: Code 9 still comes with output. Treat it as a warning, not a failure:
Exit codes lists the codes of every command, including doctor, config validate and agent status.

Run periodic reports

Because history lives in the agent’s memory and is bounded, a periodic job that writes each period’s results to disk keeps a longer record than the agent does:
Run the job as root, or as the user the agent runs as, so it can reach the agent’s socket.