Skip to content

Commit 4d4004d

Browse files
committed
pipeline: output: tls tcp: style:
Signed-off-by: Lynette Miles <[email protected]>
1 parent 5d81c13 commit 4d4004d

File tree

2 files changed

+46
-33
lines changed

2 files changed

+46
-33
lines changed

pipeline/outputs/tcp-and-tls.md

Lines changed: 45 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,64 +1,70 @@
1-
# TCP & TLS
1+
# TCP and TLS
22

3-
The **tcp** output plugin allows to send records to a remote TCP server. The payload can be formatted in different ways as required.
3+
The _TCP_ output plugin lets you send records to a remote TCP server. The payload can be formatted in different ways as required.
44

5-
## Configuration Parameters
5+
## Configuration parameters
66

7-
| Key | Description | default |
8-
|:-------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:----------|
9-
| Host | Target host where Fluent-Bit or Fluentd are listening for Forward messages. | 127.0.0.1 |
10-
| Port | TCP Port of the target service. | 5170 |
11-
| Format | Specify the data format to be printed. Supported formats are _msgpack_ _json_, _json\_lines_ and _json\_stream_. | msgpack |
12-
| json\_date\_key | Specify the name of the time key in the output record. To disable the time key just set the value to `false`. | date |
13-
| json\_date\_format | Specify the format of the date. Supported formats are _double_, _epoch_, _iso8601_ (eg: _2018-05-30T09:39:52.000681Z_) and _java_sql_timestamp_ (eg: _2018-05-30 09:39:52.000681_) | double |
14-
| workers | The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. | `2` |
7+
This plugin supports the following parameters:
158

16-
## TLS Configuration Parameters
9+
| Key | Description | Default |
10+
|:--- |:----------- |:------- |
11+
| `Host` | Target host where Fluent-Bit or Fluentd are listening for Forward messages. | `127.0.0.1` |
12+
| `Port` | TCP Port of the target service. | `5170` |
13+
| `Format` | Specify the data format to be printed. Supported formats: `msgpack`, `json`, `json_lines`, `json_stream`. | `msgpack` |
14+
| `json_date_key`| Specify the name of the time key in the output record. To disable the time key, set the value to `false`. | `date` |
15+
| `json_date_format` | Specify the format of the date. Supported formats: `double`, `epoch`, `iso8601`, `java_sql_timestamp` | `double` |
16+
| `workers` | The number of [workers](../../administration/multithreading.md#outputs) to perform flush operations for this output. | `2` |
17+
18+
## TLS configuration parameters
1719

1820
The following parameters are available to configure a secure channel connection through TLS:
1921

20-
| Key | Description | Default |
21-
|:----------------|:--------------------------------------------------------------------------------------------------------------------------------------------------|:--------|
22-
| tls | Enable or disable TLS support | Off |
23-
| tls.verify | Force certificate validation | On |
24-
| tls.debug | Set TLS debug verbosity level. It accept the following values: 0 \(No debug\), 1 \(Error\), 2 \(State change\), 3 \(Informational\) and 4 Verbose | 1 |
25-
| tls.ca\_file | Absolute path to CA certificate file | |
26-
| tls.crt\_file | Absolute path to Certificate file. | |
27-
| tls.key\_file | Absolute path to private Key file. | |
28-
| tls.key\_passwd | Optional password for tls.key\_file file. | |
22+
| Key | Description | Default |
23+
|:--- |:----------- |:------- |
24+
| `tls` | Enable or disable TLS support. | `Off` |
25+
| `tls.verify` | Force certificate validation. | `On` |
26+
| `tls.debug` | Set TLS debug verbosity level. Allowed values: `0` (No debug), `1` (Error), `2` (State change), `3` (Informational), `4` (Verbose) | `1` |
27+
| `tls.ca_file` | Absolute path to CA certificate file. | _none_ |
28+
| `tls.crt_file` | Absolute path to Certificate file. | _none_ |
29+
| `tls.key_file` | Absolute path to private Key file. | _none_ |
30+
| `tls.key_passwd` | Optional password for tls.key_file file. | _none_ |
2931

30-
### Command Line
32+
### Command line
3133

3234
#### JSON format
3335

36+
This example specifies gathering [CPU](https://docs.fluentbit.io/manual/pipeline/inputs/cpu-metrics) usage metrics and send them in JSON lines mode to a remote endpoint using netcat service.
37+
3438
```shell
3539
fluent-bit -i cpu -o tcp://127.0.0.1:5170 -p format=json_lines -v
3640
```
3741

38-
We have specified to gather [CPU](https://github.com/fluent/fluent-bit-docs/tree/16f30161dc4c79d407cd9c586a0c6839d0969d97/pipeline/input/cpu.md) usage metrics and send them in JSON lines mode to a remote end-point using netcat service.
3942

40-
Run the following in a separate terminal, `netcat` will start listening for messages on TCP port 5170.
41-
Once it connects to Fluent Bit ou should see the output as above in JSON format:
43+
Run the following in a separate terminal, `netcat` will start listening for messages on TCP port 5170. After it connects to Fluent Bit you should see the output in JSON format:
4244

4345
```shell
44-
$ nc -l 5170
46+
nc -l 5170
47+
```
4548

49+
Which returns results similar to:
50+
51+
```text
4652
...
4753
{"date":1644834856.905985,"cpu_p":1.1875,"user_p":0.5625,"system_p":0.625,"cpu0.p_cpu":0.0,"cpu0.p_user":0.0,"cpu0.p_system":0.0,"cpu1.p_cpu":1.0,"cpu1.p_user":1.0,"cpu1.p_system":0.0,"cpu2.p_cpu":4.0,"cpu2.p_user":2.0,"cpu2.p_system":2.0,"cpu3.p_cpu":1.0,"cpu3.p_user":0.0,"cpu3.p_system":1.0,"cpu4.p_cpu":1.0,"cpu4.p_user":0.0,"cpu4.p_system":1.0,"cpu5.p_cpu":1.0,"cpu5.p_user":1.0,"cpu5.p_system":0.0,"cpu6.p_cpu":0.0,"cpu6.p_user":0.0,"cpu6.p_system":0.0,"cpu7.p_cpu":3.0,"cpu7.p_user":1.0,"cpu7.p_system":2.0,"cpu8.p_cpu":0.0,"cpu8.p_user":0.0,"cpu8.p_system":0.0,"cpu9.p_cpu":1.0,"cpu9.p_user":0.0,"cpu9.p_system":1.0,"cpu10.p_cpu":1.0,"cpu10.p_user":0.0,"cpu10.p_system":1.0,"cpu11.p_cpu":0.0,"cpu11.p_user":0.0,"cpu11.p_system":0.0,"cpu12.p_cpu":0.0,"cpu12.p_user":0.0,"cpu12.p_system":0.0,"cpu13.p_cpu":3.0,"cpu13.p_user":2.0,"cpu13.p_system":1.0,"cpu14.p_cpu":1.0,"cpu14.p_user":1.0,"cpu14.p_system":0.0,"cpu15.p_cpu":0.0,"cpu15.p_user":0.0,"cpu15.p_system":0.0}
4854
...
4955
```
5056

51-
#### Msgpack format
57+
#### `msgpack` format
5258

5359
Repeat the JSON approach but using the `msgpack` output format.
5460

5561
```shell
5662
fluent-bit -i cpu -o tcp://127.0.0.1:5170 -p format=msgpack -v
5763
```
5864

59-
We could send this to stdout but as it is a serialized format you would end up with strange output.
60-
This should really be handled by a msgpack receiver to unpack as per the details in the developer documentation [here](../../development/msgpack-format.md).
61-
As an example we use the [Python msgpack library](https://msgpack.org/#languages) to deal with it:
65+
You could send this to stdout but as it's a serialized format you would end up with strange output.
66+
67+
This should be handled by a [`msgpack`](../../development/msgpack-format.md) receiver to unpack. The following example uses the [Python `msgpack` library](https://msgpack.org/#languages) handle it:
6268

6369
```python
6470
#Python3
@@ -81,11 +87,17 @@ while True:
8187
print(unpacked)
8288
```
8389

90+
Run the following commands:
91+
8492
```shell
85-
$ pip install msgpack
86-
$ python3 test.py
93+
pip install msgpack
94+
python3 test.py
95+
```
8796

97+
Which return results like:
98+
99+
```text
88100
...
89101
(ExtType(code=0, data=b'b\n5\xc65\x05\x14\xac'), {'cpu_p': 0.1875, 'user_p': 0.125, 'system_p': 0.0625, 'cpu0.p_cpu': 0.0, 'cpu0.p_user': 0.0, 'cpu0.p_system': 0.0, 'cpu1.p_cpu': 0.0, 'cpu1.p_user': 0.0, 'cpu1.p_system': 0.0, 'cpu2.p_cpu': 1.0, 'cpu2.p_user': 0.0, 'cpu2.p_system': 1.0, 'cpu3.p_cpu': 0.0, 'cpu3.p_user': 0.0, 'cpu3.p_system': 0.0, 'cpu4.p_cpu': 0.0, 'cpu4.p_user': 0.0, 'cpu4.p_system': 0.0, 'cpu5.p_cpu': 0.0, 'cpu5.p_user': 0.0, 'cpu5.p_system': 0.0, 'cpu6.p_cpu': 0.0, 'cpu6.p_user': 0.0, 'cpu6.p_system': 0.0, 'cpu7.p_cpu': 0.0, 'cpu7.p_user': 0.0, 'cpu7.p_system': 0.0, 'cpu8.p_cpu': 0.0, 'cpu8.p_user': 0.0, 'cpu8.p_system': 0.0, 'cpu9.p_cpu': 1.0, 'cpu9.p_user': 1.0, 'cpu9.p_system': 0.0, 'cpu10.p_cpu': 0.0, 'cpu10.p_user': 0.0, 'cpu10.p_system': 0.0, 'cpu11.p_cpu': 0.0, 'cpu11.p_user': 0.0, 'cpu11.p_system': 0.0, 'cpu12.p_cpu': 0.0, 'cpu12.p_user': 0.0, 'cpu12.p_system': 0.0, 'cpu13.p_cpu': 0.0, 'cpu13.p_user': 0.0, 'cpu13.p_system': 0.0, 'cpu14.p_cpu': 0.0, 'cpu14.p_user': 0.0, 'cpu14.p_system': 0.0, 'cpu15.p_cpu': 0.0, 'cpu15.p_user': 0.0, 'cpu15.p_system': 0.0})
90102
...
91-
```
103+
```

vale-styles/FluentBit/Headings.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ exceptions:
6262
- HTTP
6363
- I
6464
- InfluxDB
65+
- JSON
6566
- Kafka
6667
- Kafka Producer
6768
- Kafka REST

0 commit comments

Comments
 (0)