rpk topic analyze

Analyze topics.

This command consumes records from the specified topics to determine topic characteristics, such as batch rate and batch size.

Use the --format flag with either JSON or YAML to print all of the metadata collected.

Specify topics

List individual topics or use the --regex flag (-r) for filtering.

For example,

analyze logins transactions            # analyze topics logins and transactions
analyze -r '^l.*' '.*s$'               # analyze all topics starting with l and all topics ending in s
analyze -r '*'                         # analyze all topics
analyze -r .                           # analyze any one-character topics

Time range

Use the --time-range flag to specify the time range from which to consume records. Use the following format:

t1:t2    consume from timestamp t1 until timestamp t2

There are a few options for the timestamp syntax. rpk evaluates each option until one succeeds:

13 digits             parsed as a Unix millisecond
9 digits              parsed as a Unix second
YYYY-MM-DD            parsed as a day, UTC
YYYY-MM-DDTHH:MM:SSZ  parsed as RFC3339, UTC; fractional seconds optional (.MMM)
end                   for t2 in @t1:t2, the current end of the partition
-dur                  a negative duration from now or from a timestamp
dur                   a positive duration from now or from a timestamp

Durations can be relative to the current time or relative to a timestamp.

  • If a duration is used for t1, that duration is relative to now.

  • If a duration is used for t2, and t1 is a timestamp, then t2 is relative to t1.

  • If a duration is used for t2, and t1 is a duration, then t2 is relative to now.

Durations are parsed simply:

3ms    three milliseconds
10s    ten seconds
9m     nine minutes
1h     one hour
1m3ms  one minute and three milliseconds

For example:

-t 2022-02-14:1h   consume 1h of time on Valentine's Day 2022
-t -48h:-24h       consume from 2 days ago to 1 day ago
-t -1m:end         consume from 1m ago until now

Usage

rpk topic analyze [TOPIC] [flags]

Flags

Value Type Description

--batches

int

Minimum number of batches to consume per partition (default 10).

--format

string

Output format (json,yaml,text,wide,help) (default text).

-h, --help

-

Help for the analyze subcommand.

-a, --print-all

-

Print all sections.

--print-partition-batch-rate

-

Print the detailed partitions batch rate section.

--print-partition-batch-size

-

Print the detailed partitions batch size section.

-s, --print-summary

-

Print the summary section.

--print-topics

-

Print the topics section.

-r, --regex

-

Parse arguments as regex. Analyze any topic that matches any input topic expression.

-t, --time-range

string

Time range to consume from (-24h:end, -48h:-24h, 2022-02-14:1h) (default -1m:end).

--timeout

duration

Specifies how long the command should run before timing out (default 10s).

--config

string

Redpanda or rpk configuration file. Default search paths are /var/lib/redpanda/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml.

-X, --config-opt

stringArray

Override rpk configuration settings. Use -X help for more details or -X list for terser detail.

--profile

string

rpk profile to use.

-v, --verbose

-

Enable verbose logging.