# CLI

{% hint style="danger" %}
Warning: Setting offsets should only be used when the K2K application has been stopped.&#x20;

If the K2K application is running, the offset reset might not be applied as the application will continue to commit offsets, potentially overwriting the reset operation.
{% endhint %}

#### `describe`

Reads the pipeline definition file(s) and displays information about the consumer group(s).

<table><thead><tr><th>flag/short</th><th width="343.9166259765625">description</th><th>default</th><th>required</th></tr></thead><tbody><tr><td><code>--file</code> / <code>-f</code></td><td>Comma-separated list of file(s) that define one k2k pipeline. Can be specified multiple times.</td><td>-</td><td>Yes</td></tr><tr><td><code>--defaults</code> / <code>-d</code></td><td>File containing defaults for the k2k app. Can be specified multiple times.</td><td>-</td><td>No</td></tr><tr><td><code>--template-engine</code> / <code>-g</code></td><td>Enable or disable the template engine.</td><td><code>enabled</code></td><td>No</td></tr><tr><td><code>--pull-timeout</code> / <code>-i</code></td><td>Duration after which the control topic(s) will be considered fully read if no new messages are received.</td><td><code>10s</code></td><td>No</td></tr><tr><td><code>--verbosity</code></td><td>Sets the log verbosity (e.g., <code>debug</code>, <code>info</code>, <code>warn</code>, <code>error</code>).</td><td>-</td><td>No</td></tr></tbody></table>

**Example output:**

```
pipeline: prod-to-stg
source:   prod-cluster-id
target:   stg-cluster-id
group:    k2k-prod-to-stg
committed:
  -
    topic: user-orders
    partition: 0
    committed: 10
    last: 20
  -
    topic: user-orders
    partition: 1
    committed: 10
    last: 10
pipeline: eu-to-us
source:   eu-west-1
target:   us-east-1
group:    k2k-cross-region-consumer-group
committed:
  -
    topic: telemetry-events
    partition: 0
    committed: 1
    last: 20
```

**Examples:**

```bash
# Describe consumer groups from a single pipeline file
k2k-tool describe -f /path/to/pipeline.k2k.yml

# Reset offsets to earliest for a pipeline defined using two files
k2k-tool describe -f /path/to/pipeline.k2k.yml,/path/to/pipeline-overrides.k2k.yml

```

#### `set`

Sets the committed offset for a consumer group to a specific offset value.&#x20;

<table><thead><tr><th>flag/short</th><th width="357.9166259765625">description</th><th>default</th><th>required</th></tr></thead><tbody><tr><td><code>--file</code> / <code>-f</code></td><td>One or more comma-separated paths that define a single k2k pipeline.</td><td>-</td><td>Yes</td></tr><tr><td><code>--offset</code> / <code>-o</code></td><td>Offset selector in the format <code>&#x3C;topic>:&#x3C;partition>:&#x3C;offset></code>. Can be specified multiple times.</td><td>-</td><td>Yes</td></tr><tr><td><code>--defaults</code> / <code>-d</code></td><td>File containing defaults for the k2k app. Can be specified multiple times.</td><td>-</td><td>No</td></tr><tr><td><code>--template-engine</code> / <code>-g</code></td><td>Enable or disable the template engine.</td><td><code>enabled</code></td><td>No</td></tr><tr><td><code>--verbosity</code></td><td>Sets the log verbosity (e.g., <code>debug</code>, <code>info</code>, <code>warn</code>, <code>error</code>).</td><td>-</td><td>No</td></tr></tbody></table>

The offset selector follows the format: `<topic>:<partition>:<offset>`

* **topic**: The topic name, or `*` to match all topics
* **partition**: The partition number, or `*` to match all partitions
* **offset**: The specific offset value (numeric)

**Offset Selectors:**

* `my-topic:0:100` - Set offset 100 for partition 0 of topic `my-topic`
* `my-topic:*:100` - Set offset 100 for all partitions of topic `my-topic`
* `*:0:100` - Set offset 100 for partition 0 of all topics targeted by the pipeline
* `*:*:0` - Reset all partitions of all topics to offset 0 (earliest)

**Examples:**

```bash
# Set offset for a specific topic, partition, and offset
k2k-tool set -f /path/to/pipeline.k2k.yml -o "my-topic:0:100"

# Set multiple offsets at once
k2k-tool set -f /path/to/pipeline.k2k.yml -o "topic1:0:500" -o "topic1:1:600" -o "topic2:0:1000"

# Set offset for 
k2k-tool set -f /path/to/pipeline.k2k.yml,/path/to/pipeline-overrides.k2k.yml -o "*:*:0"
```

#### `reset`

Resets the committed offset for a consumer group to the earliest available offset (offset 0) for all topics and partitions configured in the pipeline.&#x20;

<table><thead><tr><th>flag/short</th><th width="332.25">description</th><th>default</th><th>required</th></tr></thead><tbody><tr><td><code>--file</code> / <code>-f</code></td><td>One or more comma-separated paths that define a single k2k pipeline.</td><td>-</td><td>Yes</td></tr><tr><td><code>--defaults</code> / <code>-d</code></td><td>File containing defaults for the k2k app. Can be specified multiple times.</td><td>-</td><td>No</td></tr><tr><td><code>--template-engine</code> / <code>-g</code></td><td>Enable or disable the template engine.</td><td><code>enabled</code></td><td>No</td></tr><tr><td><code>--verbosity</code></td><td>Sets the log verbosity (e.g., <code>debug</code>, <code>info</code>, <code>warn</code>, <code>error</code>).</td><td>-</td><td>No</td></tr></tbody></table>

**Examples:**

```bash
# Reset offsets to earliest for a pipeline
k2k-tool reset -f /path/to/pipeline.k2k.yml

# Reset with defaults file
k2k-tool reset -f /path/to/pipeline.k2k.yml --defaults /path/to/defaults.yml

# Reset with template engine disabled
k2k-tool reset -f /path/to/pipeline.k2k.yml --template-engine disabled

# Reset with debug verbosity
k2k-tool reset -f /path/to/pipeline.k2k.yml --verbosity debug
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.lenses.io/latest/k2k/1.2/k2k-standalone-tool/cli.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
