github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/inputs/subprocess.md (about) 1 --- 2 title: subprocess 3 type: input 4 status: beta 5 categories: ["Utility"] 6 --- 7 8 <!-- 9 THIS FILE IS AUTOGENERATED! 10 11 To make changes please edit the contents of: 12 lib/input/subprocess.go 13 --> 14 15 import Tabs from '@theme/Tabs'; 16 import TabItem from '@theme/TabItem'; 17 18 :::caution BETA 19 This component is mostly stable but breaking changes could still be made outside of major version releases if a fundamental problem with the component is found. 20 ::: 21 22 Executes a command, runs it as a subprocess, and consumes messages from it over stdout. 23 24 25 <Tabs defaultValue="common" values={[ 26 { label: 'Common', value: 'common', }, 27 { label: 'Advanced', value: 'advanced', }, 28 ]}> 29 30 <TabItem value="common"> 31 32 ```yaml 33 # Common config fields, showing default values 34 input: 35 label: "" 36 subprocess: 37 name: "" 38 args: [] 39 codec: lines 40 restart_on_exit: false 41 ``` 42 43 </TabItem> 44 <TabItem value="advanced"> 45 46 ```yaml 47 # All config fields, showing default values 48 input: 49 label: "" 50 subprocess: 51 name: "" 52 args: [] 53 codec: lines 54 restart_on_exit: false 55 max_buffer: 65536 56 ``` 57 58 </TabItem> 59 </Tabs> 60 61 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 Benthos re-execute the command each time it stops. 62 63 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. 64 65 The execution environment of the subprocess is the same as the Benthos instance, including environment variables and the current working directory. 66 67 ## Fields 68 69 ### `name` 70 71 The command to execute as a subprocess. 72 73 74 Type: `string` 75 Default: `""` 76 77 ```yaml 78 # Examples 79 80 name: cat 81 82 name: sed 83 84 name: awk 85 ``` 86 87 ### `args` 88 89 A list of arguments to provide the command. 90 91 92 Type: `array` 93 Default: `[]` 94 95 ### `codec` 96 97 The way in which messages should be consumed from the subprocess. 98 99 100 Type: `string` 101 Default: `"lines"` 102 Options: `lines`. 103 104 ### `restart_on_exit` 105 106 Whether the command should be re-executed each time the subprocess ends. 107 108 109 Type: `bool` 110 Default: `false` 111 112 ### `max_buffer` 113 114 The maximum expected size of an individual message. 115 116 117 Type: `int` 118 Default: `65536` 119 120