Skip to main content
Version: 22.2

rpk topic consume

Consume records from topics.

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. There may be more single-word-no-escapes formats added later. Outside of these special formats, formatting follows the rules described below.

Usage

rpk topic consume TOPICS... [flags]

Flags

Value Type Description
--fetch-max-bytesint32Maximum amount of bytes per fetch request per broker (default 1048576)
--fetch-max-waitdurationMaximum amount of time to wait when fetching from a broker before the broker replies (default 5s)
-g, --groupstring Group to use for consuming (incompatible with -p)
-h, --help- Help for consume
--meta-only- Print all record info except the record value (for -f json)
-n, --numint Quit after consuming this number of records (0 is unbounded)
-p, --partitionsint32int32Slice Comma delimited list of specific partitions to consume (default [])
--pretty-print-Pretty print each record over multiple lines (for -f json) (defaulttrue)
--read-committed- Opt in to reading only committed offsets
-r, --regex-Parse topics as regex; consume any topic that matches any expression
--brokersstringsComma-separated list of broker <ip>:<port> pairs (for example,--brokers '192.168.78.34:9092,192.168.78.35:9092,192.179.23.54:9092'). Alternatively, you may set the REDPANDA_BROKERSenvironment variable with the comma-separated list of broker addresses.
--configstringRedpanda config file, if not set the file will be searched for in the default locations.
--passwordstring SASL password to be used for authentication.
--sasl-mechanismstringThe authentication mechanism to use. Supported values:SCRAM-SHA-256, SCRAM-SHA-512.
--tls-certstringThe certificate to be used for TLS authentication with the broker.
--tls-enabled-Enable TLS for the Kafka API (not necessary if specifying custom certs).
--tls-keystringThe certificate key to be used for TLS authentication with the broker.
--tls-truststorestring The truststore to be used for TLS communication with the broker.
--userstring SASL user to be used for authentication.
-v, --verbose-Enable verbose logging (default false).

What do you like about this doc?




Optional: Share your email address if we can contact you about your feedback.

Let us know what we do well: