github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/inputs/sftp.md (about) 1 --- 2 title: sftp 3 type: input 4 status: experimental 5 categories: ["Network"] 6 --- 7 8 <!-- 9 THIS FILE IS AUTOGENERATED! 10 11 To make changes please edit the contents of: 12 lib/input/sftp.go 13 --> 14 15 import Tabs from '@theme/Tabs'; 16 import TabItem from '@theme/TabItem'; 17 18 :::caution EXPERIMENTAL 19 This component is experimental and therefore subject to change or removal outside of major version releases. 20 ::: 21 Consumes files from a server over SFTP. 22 23 Introduced in version 3.39.0. 24 25 26 <Tabs defaultValue="common" values={[ 27 { label: 'Common', value: 'common', }, 28 { label: 'Advanced', value: 'advanced', }, 29 ]}> 30 31 <TabItem value="common"> 32 33 ```yaml 34 # Common config fields, showing default values 35 input: 36 label: "" 37 sftp: 38 address: "" 39 credentials: 40 username: "" 41 password: "" 42 private_key_file: "" 43 private_key_pass: "" 44 paths: [] 45 codec: all-bytes 46 watcher: 47 enabled: false 48 minimum_age: 1s 49 poll_interval: 1s 50 cache: "" 51 ``` 52 53 </TabItem> 54 <TabItem value="advanced"> 55 56 ```yaml 57 # All config fields, showing default values 58 input: 59 label: "" 60 sftp: 61 address: "" 62 credentials: 63 username: "" 64 password: "" 65 private_key_file: "" 66 private_key_pass: "" 67 paths: [] 68 codec: all-bytes 69 delete_on_finish: false 70 max_buffer: 1000000 71 watcher: 72 enabled: false 73 minimum_age: 1s 74 poll_interval: 1s 75 cache: "" 76 ``` 77 78 </TabItem> 79 </Tabs> 80 81 ## Metadata 82 83 This input adds the following metadata fields to each message: 84 85 ``` 86 - sftp_path 87 ``` 88 89 You can access these metadata fields using [function interpolation](/docs/configuration/interpolation#metadata). 90 91 ## Fields 92 93 ### `address` 94 95 The address of the server to connect to that has the target files. 96 97 98 Type: `string` 99 Default: `""` 100 101 ### `credentials` 102 103 The credentials to use to log into the server. 104 105 106 Type: `object` 107 108 ### `credentials.username` 109 110 The username to connect to the SFTP server. 111 112 113 Type: `string` 114 Default: `""` 115 116 ### `credentials.password` 117 118 The password for the username to connect to the SFTP server. 119 120 121 Type: `string` 122 Default: `""` 123 124 ### `credentials.private_key_file` 125 126 The private key for the username to connect to the SFTP server. 127 128 129 Type: `string` 130 Default: `""` 131 132 ### `credentials.private_key_pass` 133 134 Optional passphrase for private key. 135 136 137 Type: `string` 138 Default: `""` 139 140 ### `paths` 141 142 A list of paths to consume sequentially. Glob patterns are supported. 143 144 145 Type: `array` 146 Default: `[]` 147 148 ### `codec` 149 150 The way in which the bytes of a data source should be converted into discrete messages, codecs are useful for specifying how large files or contiunous streams of data might be processed in small chunks rather than loading it all in memory. It's possible to consume lines using a custom delimiter with the `delim:x` codec, where x is the character sequence custom delimiter. Codecs can be chained with `/`, for example a gzip compressed CSV file can be consumed with the codec `gzip/csv`. 151 152 153 Type: `string` 154 Default: `"all-bytes"` 155 156 | Option | Summary | 157 |---|---| 158 | `auto` | EXPERIMENTAL: Attempts to derive a codec for each file based on information such as the extension. For example, a .tar.gz file would be consumed with the `gzip/tar` codec. Defaults to all-bytes. | 159 | `all-bytes` | Consume the entire file as a single binary message. | 160 | `chunker:x` | Consume the file in chunks of a given number of bytes. | 161 | `csv` | Consume structured rows as comma separated values, the first row must be a header row. | 162 | `csv:x` | Consume structured rows as values separated by a custom delimiter, the first row must be a header row. The custom delimiter must be a single character, e.g. the codec `"csv:\t"` would consume a tab delimited file. | 163 | `delim:x` | Consume the file in segments divided by a custom delimiter. | 164 | `gzip` | Decompress a gzip file, this codec should precede another codec, e.g. `gzip/all-bytes`, `gzip/tar`, `gzip/csv`, etc. | 165 | `lines` | Consume the file in segments divided by linebreaks. | 166 | `multipart` | Consumes the output of another codec and batches messages together. A batch ends when an empty message is consumed. For example, the codec `lines/multipart` could be used to consume multipart messages where an empty line indicates the end of each batch. | 167 | `regex:(?m)^\d\d:\d\d:\d\d` | Consume the file in segments divided by regular expression. | 168 | `tar` | Parse the file as a tar archive, and consume each file of the archive as a message. | 169 170 171 ```yaml 172 # Examples 173 174 codec: lines 175 176 codec: "delim:\t" 177 178 codec: delim:foobar 179 180 codec: gzip/csv 181 ``` 182 183 ### `delete_on_finish` 184 185 Whether to delete files from the server once they are processed. 186 187 188 Type: `bool` 189 Default: `false` 190 191 ### `max_buffer` 192 193 The largest token size expected when consuming delimited files. 194 195 196 Type: `int` 197 Default: `1000000` 198 199 ### `watcher` 200 201 An experimental mode whereby the input will periodically scan the target paths for new files and consume them, when all files are consumed the input will continue polling for new files. 202 203 204 Type: `object` 205 Requires version 3.42.0 or newer 206 207 ### `watcher.enabled` 208 209 Whether file watching is enabled. 210 211 212 Type: `bool` 213 Default: `false` 214 215 ### `watcher.minimum_age` 216 217 The minimum period of time since a file was last updated before attempting to consume it. Increasing this period decreases the likelihood that a file will be consumed whilst it is still being written to. 218 219 220 Type: `string` 221 Default: `"1s"` 222 223 ```yaml 224 # Examples 225 226 minimum_age: 10s 227 228 minimum_age: 1m 229 230 minimum_age: 10m 231 ``` 232 233 ### `watcher.poll_interval` 234 235 The interval between each attempt to scan the target paths for new files. 236 237 238 Type: `string` 239 Default: `"1s"` 240 241 ```yaml 242 # Examples 243 244 poll_interval: 100ms 245 246 poll_interval: 1s 247 ``` 248 249 ### `watcher.cache` 250 251 A [cache resource](/docs/components/caches/about) for storing the paths of files already consumed. 252 253 254 Type: `string` 255 Default: `""` 256 257