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
./configure (...) --add-dynamic-module=./ngx_http_websocket_stat_module && make modules
13
15
```
14
16
2. Build nginx with make -j<n> command where n is number of cpu cores on your build machine
15
17
@@ -22,9 +24,10 @@ Nginx module developed for logging and displaying statistic of websocket proxy c
22
24
23
25
## Usage
24
26
25
-
To enable websocket logging specify log file in server section of nginx config file with ws_log directibe.
27
+
To enable websocket frames logging specify `log_enabled on` and `ws_log_format`in server section of nginx config file. Additionally, specify `ws_log` to override the log file, which is used to log ws frames.
26
28
27
-
You can specify your own websocket log format using ws_log_format directive in server section. To customize connection open and close log messages use "open" and "close" parameter for ws_log_format directive.
29
+
To customize connection open and close log messages use "open" and "close" parameter for ws_log_format directive.
30
+
To log only when the full message is received/sent use "message" parameter for ws_log_format directive.
28
31
29
32
Maximum number of concurrent websocket connections could be specified with ws_max_connections on server section. This value applies to whole connections that are on nginx. Argument should be integer representing maximum connections. When client tries to open more connections it recevies close framee with 1013 error code and connection is closed on nginx side. If zero number of connections is given there would be no limit on websocket connections.
30
33
@@ -34,7 +37,8 @@ To set maximum single connection lifetime use ws_conn_age parameter. Argument is
34
37
Here is a list of variables you can use in log format string:
35
38
36
39
* $ws_opcode - websocket packet opcode. Look into https://tools.ietf.org/html/rfc6455 Section 5.2, Base Framing Protocol.
37
-
* $ws_payload_size - Websocket packet size without protocol specific data. Only data that been sent or received by the client
40
+
* $ws_payload_size - Size of the WS frame without protocol specific data. Only data that been sent or received by the client
41
+
* $ws_message_size - Size of the WS message without protocol specific data. Only data that been sent or received by the client
38
42
* $ws_packet_source - Could be "client" if packet has been sent by the user or "upstream" if it has been received from the server
39
43
* $ws_conn_age - Number of seconds connection is alive
40
44
* $time_local - Nginx local time, date and timezone
@@ -48,8 +52,6 @@ Here is a list of variables you can use in log format string:
48
52
* $server_port - Server's port
49
53
* $upstream_addr - websocket backend address
50
54
51
-
To read websocket statistic there is GET request should be set up at "location" location of nginx config file with ws_stat command in it. Look into example section for details.
52
-
53
55
## Example of configuration
54
56
55
57
```
@@ -62,10 +64,6 @@ server
62
64
ws_log_format close "$time_local: Connection closed";
0 commit comments