rpk topic analyze

Analyze topics.

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

To print all of the metadata collected, use the --format flag with either JSON or YAML.

Usage

rpk topic analyze <topic> [flags]

Topics

Topics can either be listed individually or by regex via the --regex flag (-r).

For example,

Value Description

analyze foo bar

analyze -r '^f.*' '.*r$'

analyze -r '*'

analyze -r .

Time Range

The --time-range flag specifies the time range to consume from. 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:

Value Description

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:

Value Description

3ms

three milliseconds

10s

ten seconds

9m

nine minutes

1h

one hour

1m3ms

one minute and three milliseconds

For example,

Value Description

-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

Flags

Value Type Description

--batches

int

Minimum number of batches to consume per partition.

--format

string

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

-a, --print-all

bool

Print all sections.

--print-partition-batch-rate

bool

Print the detailed partitions batch rate section.

--print-partition-batch-size

bool

Print the detailed partitions batch size section.

-s, --print-summary

bool

Print the summary section.

--print-topics

bool

Print the topics section.

-r, --regex

bool

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).

--timeout

duration

Maximum duration for the command to run before timing out.

Global flags

Value Type Description

--config

string

Redpanda or rpk config file; default search paths are ~/.config/rpk/rpk.yaml, $PWD/redpanda.yaml, and /etc/redpanda/redpanda.yaml.

-X, --config-opt

stringArray

Override rpk configuration settings; -X help for detail or -X list for terser detail.

--ignore-profile

bool

Ignore rpk.yaml and redpanda.yaml; use default settings.

--profile

string

rpk profile to use.

-v, --verbose

bool

Enable verbose logging.