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
Copy file name to clipboardExpand all lines: pipeline/outputs/websocket.md
+34-20Lines changed: 34 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,6 @@ The **websocket** output plugin allows to flush your records into a WebSocket en
12
12
| Format | Specify the data format to be used in the HTTP request body, by default it uses _msgpack_. Other supported formats are _json_, _json\_stream_ and _json\_lines_ and _gelf_. | msgpack |
13
13
| json\_date\_key | Specify the name of the date field in output | date |
14
14
| json\_date\_format | Specify the format of the date. Supported formats are _double_ and _iso8601_\(eg: _2018-05-30T09:39:52.000681Z_\)| double |
15
-
| idle\_interval | The interval that websocket output plugin would keep to decide if it is OK to reconnet to Websocket Server | 20 |
16
15
17
16
## Getting Started
18
17
@@ -48,12 +47,10 @@ In your main configuration file, append the following _Input_ & _Output_ section
48
47
Port 80
49
48
URI/something
50
49
Format json
51
-
Idle_interval 21
52
50
```
53
51
54
-
Suggested configuration for Idle Interval is 20. Websocket plugin is working with tcp keepalive mode, please refer to [networking](https://docs.fluentbit.io/manual/v/master/administration/networking#configuration-options) section for details.
52
+
Websocket plugin is working with tcp keepalive mode, please refer to [networking](https://docs.fluentbit.io/manual/v/master/administration/networking#configuration-options) section for details. Since websocket is a stateful plugin, it will decide when to send out handshake to server side, for example when plugin just begins to work or after connection with server has been dropped. In general, the interval to init a new websocket handshake would be less than the keepalive interval. With that stratgy, it could detect and resume websocket connetions.
55
53
56
-
By default, if there is no traffic for about 30 seconds, fluent-bit would abort the tcp connection. As a result, if websocket would like to send data to the same server again, it has to reconnect. This parameter is to help to determine if websocket need to reconnect or not.
57
54
58
55
## Testing
59
56
@@ -69,10 +66,12 @@ By default, if there is no traffic for about 30 seconds, fluent-bit would abort
69
66
Name websocket
70
67
Match *
71
68
Host 127.0.0.1
72
-
Port 9000
69
+
Port 8080
73
70
URI /
74
71
Format json
75
-
Idle_interval 21
72
+
workers 4
73
+
net.keepalive on
74
+
net.keepalive_idle_timeout 30
76
75
```
77
76
78
77
Once Fluent Bit is running, you can send some messages using the _netcat_:
From the output of fluent-bit log, we see that once data has been ingested into fluent bit, plugin would perform handshake. After a while, no data or traffic is undergoing, tcp connection has been abort. And then another piece of data arrived, a try fro websocket plugin has been triggered, following with another handshake and data flush.
123
+
From the output of fluent-bit log, we see that once data has been ingested into fluent bit, plugin would perform handshake. After a while, no data or traffic is undergoing, tcp connection would been abort. And then another piece of data arrived, a retry for websocket plugin has been triggered, with another handshake and data flush.
0 commit comments