github.com/Jeffail/benthos/v3@v3.65.0/website/docs/components/inputs/socket.md (about)

     1  ---
     2  title: socket
     3  type: input
     4  status: stable
     5  categories: ["Network"]
     6  ---
     7  
     8  <!--
     9       THIS FILE IS AUTOGENERATED!
    10  
    11       To make changes please edit the contents of:
    12       lib/input/socket.go
    13  -->
    14  
    15  import Tabs from '@theme/Tabs';
    16  import TabItem from '@theme/TabItem';
    17  
    18  
    19  Connects to a tcp or unix socket and consumes a continuous stream of messages.
    20  
    21  
    22  <Tabs defaultValue="common" values={[
    23    { label: 'Common', value: 'common', },
    24    { label: 'Advanced', value: 'advanced', },
    25  ]}>
    26  
    27  <TabItem value="common">
    28  
    29  ```yaml
    30  # Common config fields, showing default values
    31  input:
    32    label: ""
    33    socket:
    34      network: unix
    35      address: /tmp/benthos.sock
    36      codec: lines
    37  ```
    38  
    39  </TabItem>
    40  <TabItem value="advanced">
    41  
    42  ```yaml
    43  # All config fields, showing default values
    44  input:
    45    label: ""
    46    socket:
    47      network: unix
    48      address: /tmp/benthos.sock
    49      codec: lines
    50      max_buffer: 1000000
    51  ```
    52  
    53  </TabItem>
    54  </Tabs>
    55  
    56  ## Fields
    57  
    58  ### `network`
    59  
    60  A network type to assume (unix|tcp).
    61  
    62  
    63  Type: `string`  
    64  Default: `"unix"`  
    65  Options: `unix`, `tcp`.
    66  
    67  ### `address`
    68  
    69  The address to connect to.
    70  
    71  
    72  Type: `string`  
    73  Default: `"/tmp/benthos.sock"`  
    74  
    75  ```yaml
    76  # Examples
    77  
    78  address: /tmp/benthos.sock
    79  
    80  address: 127.0.0.1:6000
    81  ```
    82  
    83  ### `codec`
    84  
    85  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`.
    86  
    87  
    88  Type: `string`  
    89  Default: `"lines"`  
    90  Requires version 3.42.0 or newer  
    91  
    92  | Option | Summary |
    93  |---|---|
    94  | `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. |
    95  | `all-bytes` | Consume the entire file as a single binary message. |
    96  | `chunker:x` | Consume the file in chunks of a given number of bytes. |
    97  | `csv` | Consume structured rows as comma separated values, the first row must be a header row. |
    98  | `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. |
    99  | `delim:x` | Consume the file in segments divided by a custom delimiter. |
   100  | `gzip` | Decompress a gzip file, this codec should precede another codec, e.g. `gzip/all-bytes`, `gzip/tar`, `gzip/csv`, etc. |
   101  | `lines` | Consume the file in segments divided by linebreaks. |
   102  | `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. |
   103  | `regex:(?m)^\d\d:\d\d:\d\d` | Consume the file in segments divided by regular expression. |
   104  | `tar` | Parse the file as a tar archive, and consume each file of the archive as a message. |
   105  
   106  
   107  ```yaml
   108  # Examples
   109  
   110  codec: lines
   111  
   112  codec: "delim:\t"
   113  
   114  codec: delim:foobar
   115  
   116  codec: gzip/csv
   117  ```
   118  
   119  ### `max_buffer`
   120  
   121  The maximum message buffer size. Must exceed the largest message to be consumed.
   122  
   123  
   124  Type: `int`  
   125  Default: `1000000`  
   126  
   127