# rpk topic analyze

> For the complete documentation index, see [llms.txt](https://docs.redpanda.com/llms.txt). Component-specific: [streaming-full.txt](https://docs.redpanda.com/streaming-full.txt)

---
title: rpk topic analyze
latest-redpanda-tag: v26.1.14
latest-console-tag: v3.9.0
latest-operator-version: v26.2.1
# EOL = End-of-Life (support lifecycle status)
page-is-nearing-eol: "false"
page-is-past-eol: "false"
page-eol-date: March 31, 2027
latest-connect-version: 4.104.0
docname: rpk/rpk-topic/rpk-topic-analyze
page-component-name: streaming
page-version: "26.1"
page-component-version: "26.1"
page-component-title: Streaming
page-relative-src-path: rpk/rpk-topic/rpk-topic-analyze.adoc
page-edit-url: https://github.com/redpanda-data/docs/edit/v/26.1/modules/reference/pages/rpk/rpk-topic/rpk-topic-analyze.adoc
description: Analyze topics. This command consumes records from the specified topics to determine topic characteristics such as batch rate and batch size.
page-git-created-date: "2025-04-07"
page-git-modified-date: "2026-07-17"
support-status: supported
---

<!-- Source: https://docs.redpanda.com/streaming/26.1/reference/rpk/rpk-topic/rpk-topic-analyze.md -->

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

```bash
rpk topic analyze <topic> [flags]
```

### [](#topics)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)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)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)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. |