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-bytes | int32 | Maximum amount of bytes per fetch request per broker (default 1048576) |
--fetch-max-wait | duration | Maximum amount of time to wait when fetching from a broker before the broker replies (default 5s) |
-g, --group | string | 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, --num | int | Quit after consuming this number of records (0 is unbounded) |
-p, --partitions | int32 | int32Slice 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 |
--brokers | strings | Comma-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_BROKERS environment variable with the comma-separated list of broker addresses. |
--config | string | Redpanda config file, if not set the file will be searched for in the default locations. |
--password | string | SASL password to be used for authentication. |
--sasl-mechanism | string | The authentication mechanism to use. Supported values:SCRAM-SHA-256 , SCRAM-SHA-512 . |
--tls-cert | string | The 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-key | string | The certificate key to be used for TLS authentication with the broker. |
--tls-truststore | string | The truststore to be used for TLS communication with the broker. |
--user | string | SASL user to be used for authentication. |
-v, --verbose | - | Enable verbose logging (default false ). |