---
title: subprocess
latest-connect-version: 4.118.0
latest-operator-version: v26.2.6
latest-console-tag: v3.14.0
latest-redpanda-tag: v26.2.7
docname: inputs/subprocess
page-component-name: connect
page-version: master
page-component-version: master
page-component-title: Connect
page-relative-src-path: inputs/subprocess.adoc
page-edit-url: https://github.com/redpanda-data/rp-connect-docs/edit/main/modules/components/pages/inputs/subprocess.adoc
description: Executes a command, runs it as a subprocess, and consumes messages from it over stdout.
page-context-switcher:
  - name: Input
    to: /connect/components/inputs/subprocess/
  - name: Output
    to: /connect/components/outputs/subprocess/
  - name: Processor
    to: /connect/components/processors/subprocess/
page-self-managed-only: "true"
page-git-created-date: "2024-05-24"
page-git-modified-date: "2026-10-29"
page-generated-sources:
  - include: connect:components:partial$descriptions/inputs/subprocess.adoc
    generator: null
    version: null
    source: the component specs in https://github.com/redpanda-data/connect
  - include: connect:components:partial$availability/inputs/subprocess.adoc
    generator: null
    version: null
    source: the component specs in https://github.com/redpanda-data/connect
  - include: connect:components:partial$fields/inputs/subprocess.adoc
    generator: null
    version: null
    source: the component specs in https://github.com/redpanda-data/connect
page-generated-content: partial
---

# subprocess

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

<!-- Source: https://docs.redpanda.com/connect/components/inputs/subprocess.md -->

> ⚠️ **CAUTION**
>
> This component is in beta. Its behavior might change in a future release.

Executes a command, runs it as a subprocess, and consumes messages from it over stdout.

Messages are consumed according to a specified codec. The command is executed once and if it terminates the input also closes down gracefully. Alternatively, the field `restart_on_close` can be set to `true` in order to have Redpanda Connect re-execute the command each time it stops.

The field `max_buffer` defines the maximum message size able to be read from the subprocess. This value should be set significantly above the real expected maximum message size.

The execution environment of the subprocess is the same as the Redpanda Connect instance, including environment variables and the current working directory.

#### Common

```yml
input:
  label: ""
  subprocess:
    name: "" # No default (required)
    args: []
    codec: lines
    restart_on_exit: false
```

#### Advanced

```yml
input:
  label: ""
  subprocess:
    name: "" # No default (required)
    args: []
    codec: lines
    restart_on_exit: false
    max_buffer: 65536
```

## Fields

### `args[]`

A list of arguments to provide the command.

**Type**: `array<string>`

**Default**: `[]`

### `codec`

The way in which messages should be consumed from the subprocess.

**Type**: `string`

**Default**: `lines`

**Options**: `lines`

### `max_buffer`

The maximum expected size of an individual message.

**Type**: `int`

**Default**: `65536`

### `name`

The command to execute as a subprocess.

**Type**: `string`

```yaml
# Examples:
name: cat

# ---

name: sed

# ---

name: awk
```

### `restart_on_exit`

Whether the command should be re-executed each time the subprocess ends.

**Type**: `bool`

**Default**: `false`