<a id="manage-consumer-groups"></a>

# View Consumer Group Info in Kafka

Apache Kafka® is an open-source distributed streaming system used for stream processing,
real-time data pipelines, and data integration at scale.

Kafka provides a [kafka-groups.sh](kafka-tools.md#kafka-consumer-group-usage) tool that enables you to
check the consumer position and view general consumer group info.

For a complete list of command-line tools that are provided with Kafka, see [Kafka Command-Line Interface (CLI) Tools](kafka-tools.md#kafka-cli-tools).
For client, consumer, and producer tools, see [Client, producer, and consumer tools](kafka-tools.md#client-producer-consumer-tools).

## Check consumer position

Sometimes it’s useful to see the position of your consumers. The
`kafka-consumer-groups` tool shows the position of all consumers in a consumer group and
how far behind the end of the log they are.

The command to run this tool on a consumer group named `my-group` consuming a topic named `my-topic`
would look like this:

```shell
bin/kafka-consumer-groups.sh \
            --bootstrap-server localhost:9092 \
            --describe --group my-group
```

The output would be similar to the following (CONSUMER-IDs truncated for readability):

```shell
TOPIC          PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG CONSUMER-ID       HOST         CLIENT-ID
my-topic       0          2               4               2   consumer-1-...    /127.0.0.1   consumer-1
my-topic       1          2               3               1   consumer-1-...    /127.0.0.1   consumer-1
my-topic       2          2               3               1   consumer-2-...    /127.0.0.1   consumer-2
```

## List groups and view offsets

The `kafka-consumer-groups` tool also enables you to list, describe, or delete consumer groups.
The consumer group can be deleted manually, or automatically when the last committed offset for that group expires.

Manual deletion will be successful only if the group does not have any active
members.

To list all consumer groups across all topics:

```shell
./bin/kafka-consumer-groups.sh \
           --bootstrap-server localhost:9092 \
           --list
```

The output should be similar to the following:

```shell
test-consumer-group
```

To filter the list of consumer groups by their protocol type, use the `--list` and `--type` flags.
You can specify a single type or a comma-separated list of types, such as `classic` or `consumer`.

```shell
./bin/kafka-consumer-groups.sh \
    --bootstrap-server localhost:9092 \
    --list \
    --type classic,consumer
```

The command returns only the consumer groups that match one of the specified types.

To view offsets, use the tool with the `describe` command,
like the following:

```shell
./bin/kafka-consumer-groups.sh \
                 --bootstrap-server localhost:9092 \
                 --describe \
                 --group my-group
```

The output would be similar to the following (CONSUMER-IDs truncated for readability):

```shell
TOPIC           PARTITION  CURRENT-OFFSET  LOG-END-OFFSET  LAG       CONSUMER-ID       HOST            CLIENT-ID
topic3          0          241019          395308          154289    consumer2-e76e... /127.0.0.1      consumer2
topic2          1          520678          803288          282610    consumer2-e76e... /127.0.0.1      consumer2
topic3          1          241018          398817          157799    consumer2-e76e... /127.0.0.1      consumer2
topic1          0          854144          855809          1665      consumer1-3fc8... /127.0.
```

<a id="confluenttip-0"></a>

## Related content

- [Kafka Consumer Design: Consumers, Consumer Groups, and Offsets](../design/consumer-design.md#consumer-design)
- [kafka-consumer-groups tool](kafka-tools.md#kafka-consumer-group-usage)
- [Consumer configuration reference (Confluent documentation)](/platform/current/installation/configuration/consumer-configs.html)

#### NOTE
This website includes content developed at the [Apache Software Foundation](https://www.apache.org/)
under the terms of the [Apache License v2](https://www.apache.org/licenses/LICENSE-2.0.html).
