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

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