Skip to content
Open
13 changes: 9 additions & 4 deletions modules/reference/pages/rpk/rpk-topic/rpk-topic-consume.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ Consuming records reads from any amount of input topics, formats each record
according to `--format`, and prints them to `STDOUT`. The output formatter
understands a wide variety of formats.

The default output format `--format json` is a special format that outputs each
record as JSON.
By default, `rpk topic consume` opens a persistent connection and waits
indefinitely for new records to arrive. It does not exit after consuming
existing records. To stop consuming, press kbd:[Ctrl+C], or use `--num` to exit
after a fixed number of records, or specify an end offset with `--offset`
(for example, `-o :end`).

`--format json` is the default, and outputs each record as a JSON object.

include::reference:partial$topic-format.adoc[]

Expand Down Expand Up @@ -82,7 +87,7 @@ specification, similar to timestamps above.

Unpacking text can allow translating binary input into readable output. If a
value is a big-endian uint32, `%v` prints the raw four bytes, while
`%v{unpack[>I]}` prints the number in as ASCII. If unpacking exhausts the
`%v{unpack[>I]}` prints the number as ASCII. If unpacking exhausts the
input before something is unpacked fully, an error message is appended to the
output.

Expand All @@ -103,7 +108,7 @@ of the above rules about `%K`, `%V`, text, and numbers apply.

Values for consumed records can be omitted by using the `--meta-only` flag.

Tombstone records (records with a `null` value) have their value omitted from the JSON output by default. All other records, including those with an empty-string value (`""`), will have their values printed.
Tombstone records (records with a `null` value) have their value omitted from the JSON output by default. All other records, including those with an empty-string value (`""`), have their values printed.

== Offsets

Expand Down
Loading