---
title: kapacitor record stream
description: The kapacitor record stream command records the result of a Kapacitor stream task.
url: https://docs.influxdata.com/kapacitor/v1/reference/cli/kapacitor/record/stream/
estimated_tokens: 461
product: Kapacitor
version: v1
publisher: InfluxData
canonical: https://docs.influxdata.com/kapacitor/v1/reference/cli/kapacitor/record/stream/
date: '2023-10-03T10:49:57-06:00'
lastmod: '2023-10-03T10:49:57-06:00'
---

The `kapacitor record stream` command records the result of a Kapacitor stream task.
Once the recording is stopped, the command outputs the recording ID.
If no recording ID is specified, Kapacitor assigns a random ID.

The command requires the following:

* **Recording duration**: Use the `-duration` flag
* **Task ID**: Use the `-task` flag

*To replay the recording, see [`kapacitor replay`](/kapacitor/v1/reference/cli/kapacitor/replay/).*

## Usage

```sh
kapacitor record stream [flags]
```

## Flags

|     Flag      |                     Description                     |
|---------------|-----------------------------------------------------|
|  `-duration`  |    Required: How long to record the data stream     |
|  `-no-wait`   |           Run recording in the background           |
|`-recording-id`|            ID to assign to the recording            |
|    `-task`    |Required: Task ID (uses the `dbrp` value in the task)|

## Examples

* [Record a stream task](#record-a-stream-task)
* [Record a stream task and assign a custom recording ID](#record-a-stream-task-and-assign-a-custom-recording-id)

### Record a stream task

```sh
kapacitor record stream \
  -task example-task-id \
  -duration 1h
```

### Record a stream task and assign a custom recording ID

```sh
kapacitor record stream \
  -task example-task-id \
  -duration 1h \
  -recording-id 1h-example-stream-rec
```

#### Related

* [Kapacitor data sampling](/kapacitor/v1/working/cli_client/#data-sampling)
* [kapacitor replay](/kapacitor/v1/reference/cli/kapacitor/replay/)
| Flag | Description |
| --- | --- |
| Flag | Description |
| -duration | Required : How long to record the data stream |
| -no-wait | Run recording in the background |
| -recording-id | ID to assign to the recording |
| -task | Required : Task ID (uses the  dbrp  value in the task) |
