You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[Fluent Bit](https://fluentbit.io) implements a unified networking interface that is exposed to components like plugins. This interface abstract all the complexity of general I/O and is fully configurable.
3
+
[Fluent Bit](https://fluentbit.io) implements a unified networking interface that's
4
+
exposed to components like plugins. This interface abstracts all the complexity of
5
+
general I/O and is fully configurable.
4
6
5
-
A common use case is when a component or plugin needs to connect to a service to send and receive data. Despite the operational mode sounds easy to deal with, there are many factors that can make things hard like unresponsive services, networking latency or any kind of connectivity error. The networking interface aims to abstract and simplify the network I/O handling, minimize risks and optimize performance.
7
+
A common use case is when a component or plugin needs to connect to a service to send
8
+
and receive data. There are many challenges to handle like unresponsive services,
9
+
networking latency, or any kind of connectivity error. The networking interface aims
10
+
to abstract and simplify the network I/O handling, minimize risks, and optimize
11
+
performance.
6
12
7
-
## Concepts
13
+
## Networking concepts
8
14
9
-
### TCP Connect Timeout
15
+
Fluent Bit uses the following networking concepts:
10
16
11
-
Most of the time creating a new TCP connection to a remote server is straightforward and takes a few milliseconds. But there are cases where DNS resolving, slow network or incomplete TLS handshakes might create long delays, or incomplete connection statuses.
12
-
13
-
The `net.connect_timeout` allows to configure the maximum time to wait for a connection to be established, note that this value already considers the TLS handshake process.
17
+
### TCP connect timeout
14
18
15
-
The `net.connect_timeout_log_error` indicates if an error should be logged in case of connect timeout. If disabled, the timeout is logged as debug level message instead.
19
+
Most of the time creating a new TCP connection to a remote server is straightforward and takes a few milliseconds. But there are cases where DNS resolving, slow network or incomplete TLS handshakes might create long delays, or incomplete connection statuses.
16
20
17
-
### TCP Source Address
21
+
`net.connect_timeout` lets you configure the maximum time to wait for a connection
22
+
to be established. This value already considers the TLS handshake process.
18
23
19
-
On environments with multiple network interfaces, might be desired to choose which interface to use for our data that will flow through the network.
24
+
`net.connect_timeout_log_error` indicates if an error should be logged in case of
25
+
connect timeout. If disabled, the timeout is logged as a debug level message.
20
26
21
-
The `net.source_address` allows to specify which network address must be used for a TCP connection and data flow.
27
+
### TCP source address
22
28
23
-
### Connection Keepalive
29
+
On environments with multiple network interfaces, you can choose which
30
+
interface to use for Fluent Bit data that will flow through the network.
24
31
25
-
TCP is a _connected oriented_ channel, to deliver and receive data from a remote end-point in most of cases we use a TCP connection. This TCP connection can be created and destroyed once is not longer needed, this approach has pros and cons, here we will refer to the opposite case: keep the connection open.
32
+
Use `net.source_address` to specify which network address to use for a TCP connection
33
+
and data flow.
26
34
27
-
The concept of `Connection Keepalive` refers to the ability of the client \(Fluent Bit on this case\) to keep the TCP connection open in a persistent way, that means that once the connection is created and used, instead of close it, it can be recycled. This feature offers many benefits in terms of performance since communication channels are always established before hand.
35
+
### Connection keepalive
28
36
29
-
Any component that uses TCP channels like HTTP or [TLS](transport-security.md), can take advantage of this feature. For configuration purposes use the `net.keepalive` property.
37
+
A connection keepalive refers to the ability of a client to keep the TCP connection
38
+
open in a persistent way. This feature offers many benefits in terms
39
+
of performance since communication channels are always established before hand.
30
40
31
-
### Connection Keepalive Idle Timeout
41
+
Any component that uses TCP channels like HTTP or [TLS](transport-security.md), can
42
+
take advantage of this feature. For configuration purposes use the `net.keepalive`
43
+
property.
32
44
33
-
If a connection is keepalive enabled, there might be scenarios where the connection can be unused for long periods of time. Having an idle keepalive connection is not helpful and is recommendable to keep them alive if they are used.
45
+
### Connection keepalive idle timeout
34
46
35
-
In order to control how long a keepalive connection can be idle, we expose the configuration property called `net.keepalive_idle_timeout`.
47
+
If a connection is keepalive enabled, there might be scenarios where the connection
48
+
can be unused for long periods of time. Unused connections can be removed. To control
49
+
how long a keepalive connection can be idle, Fluent Bit uses a configuration property
50
+
called `net.keepalive_idle_timeout`.
36
51
37
52
### DNS mode
38
53
39
-
If a transport layer protocol is specified, the plugin whose configuration section the `net.dns.mode` setting is specified on overrides the global `dns.mode` value and issues DNS requests using the specified protocol which can be either TCP or UDP
40
-
41
-
### Max Connections Per Worker
42
-
43
-
By default, Fluent Bit tries to deliver data as faster as possible and create TCP connections on-demand and in keepalive mode for performance reasons. In high-scalable environments, the user might want to control how many connections are done in parallel by setting a limit.
44
-
45
-
This can be done by the configuration property called `net.max_worker_connections` that can be used in the output plugins sections.
46
-
This feature acts at the worker level, e.g., if you have 5 workers and `net.max_worker_connections` is set to 10, a max of 50 connections will be allowed.
47
-
If the limit is reached, the output plugin will issue a retry.
48
-
49
-
50
-
## Configuration Options
51
-
52
-
For plugins that rely on networking I/O, the following section describes the network configuration properties available and how they can be used to optimize performance or adjust to different configuration needs:
|`net.connect_timeout`| Set maximum time expressed in seconds to wait for a TCP connection to be established, this include the TLS handshake time. | 10 |
57
-
|`net.connect_timeout_log_error`| On connection timeout, specify if it should log an error. When disabled, the timeout is logged as a debug message. | true |
58
-
|`net.dns.mode`| Select the primary DNS connection type (TCP or UDP). Can be set in the [SERVICE] section and overridden on a per plugin basis if desired. ||
59
-
|`net.dns.prefer_ipv4`| Prioritize IPv4 DNS results when trying to establish a connection. | false |
60
-
|`net.dns.resolver`| Select the primary DNS resolver type (LEGACY or ASYNC). ||
61
-
|`net.keepalive`| Enable or disable connection keepalive support. Accepts a boolean value: on / off. | on |
62
-
|`net.keepalive_idle_timeout`| Set maximum time expressed in seconds for an idle keepalive connection. | 30 |
63
-
|`net.keepalive_max_recycle`| Set maximum number of times a keepalive connection can be used before it is retired. | 2000 |
64
-
|`net.max_worker_connections`| Set maximum number of TCP connections that can be established per worker. | 0 (unlimited) |
65
-
|`net.source_address`| Specify network address to bind for data traffic. ||
54
+
The global `dns.mode` value issues DNS requests using the specified protocol, either
55
+
TCP or UDP. If a transport layer protocol is specified, plugins that configure the
56
+
`net.dns.mode` setting override the global setting.
57
+
58
+
### Maximum connections per worker
59
+
60
+
Fluent Bit tries to deliver data as faster as possible and create TCP connections
61
+
on-demand and in keepalive mode for performance reasons. In highly scalable
62
+
environments, you might want to control how many connections are done in
63
+
parallel by setting a limit.
64
+
65
+
Use the property called `net.max_worker_connections` property in the output plugins
66
+
sections. This property acts at the worker level. For example, if you have 5 workers
67
+
and `net.max_worker_connections` is set to 10, a maximum of 50 connections will be
68
+
allowed. If the limit is reached, the output plugin will issue a retry.
69
+
70
+
## Configuration options
71
+
72
+
The following table describes the network configuration properties available and
73
+
their usage in optimizing performance or adjusting configuration needs for plugins
74
+
that rely on networking I/O:
75
+
76
+
| Property | Description | Default |
77
+
| :------- |:------------|:--------|
78
+
|`net.connect_timeout`| Set maximum time expressed in seconds to wait for a TCP connection to be established, this include the TLS handshake time. |`10`|
79
+
|`net.connect_timeout_log_error`| On connection timeout, specify if it should log an error. When disabled, the timeout is logged as a debug message. |`true`|
80
+
|`net.dns.mode`| Select the primary DNS connection type (TCP or UDP). Can be set in the [SERVICE] section and overridden on a per plugin basis if desired. |_none_|
81
+
|`net.dns.prefer_ipv4`| Prioritize IPv4 DNS results when trying to establish a connection. |`false`|
82
+
|`net.dns.resolver`| Select the primary DNS resolver type (`LEGACY` or `ASYNC`). |_none_|
83
+
|`net.keepalive`| Enable or disable connection keepalive support. Accepts a Boolean value: `on` or `off`. |`on`|
84
+
|`net.keepalive_idle_timeout`| Set maximum time expressed in seconds for an idle keepalive connection. |`30`|
85
+
|`net.keepalive_max_recycle`| Set maximum number of times a keepalive connection can be used before it's retired. |`2000`|
86
+
|`net.max_worker_connections`| Set maximum number of TCP connections that can be established per worker. |`0` (unlimited) |
87
+
|`net.source_address`| Specify network address to bind for data traffic. |_none_|
66
88
67
89
## Example
68
90
69
-
As an example, we will send 5 random messages through a TCP output connection, in the remote side we will use `nc`\(netcat\) utility to see the data.
91
+
This example sends 5 random messages through a TCP output connection. The remote
92
+
side uses the `nc` (netcat) utility to see the data.
70
93
71
94
Put the following configuration snippet in a file called `fluent-bit.conf`:
72
95
@@ -96,10 +119,11 @@ Put the following configuration snippet in a file called `fluent-bit.conf`:
96
119
In another terminal, start `nc` and make it listen for messages on TCP port 9090:
97
120
98
121
```text
99
-
$ nc -l 9090
122
+
nc -l 9090
100
123
```
101
124
102
-
Now start Fluent Bit with the configuration file written above and you will see the data flowing to netcat:
125
+
Now start Fluent Bit with the configuration file written previously and you will see
If the `net.keepalive` option is not enabled, Fluent Bit will close the TCP connection and netcat will quit, here we can see how the keepalive connection works.
137
+
If the `net.keepalive` option isn't enabled, Fluent Bit will close the TCP connection
138
+
and netcat will quit.
114
139
115
-
After the 5 records arrive, the connection will keep idle and after 10 seconds it will be closed due to `net.keepalive_idle_timeout`.
140
+
After the 5 records arrive, the connection will idle. After 10 seconds it will be
0 commit comments