How to log the number of bytes sent over a websocket?

Sergey Kandaurov pluknet at nginx.com
Mon Jun 25 12:04:58 UTC 2018


> On 22 Jun 2018, at 16:38, Fabrice Triboix <ftriboix at incise.co> wrote:
> 
> Hi All,
> 
> I am using nginx as a websocket reverse-proxy (this is working fine BTW). I would like to log the number of bytes sent (and ideally also received) over a websocket. If I use `$body_bytes_sent` in `log_format`, the entry in the access_log is always 0. As far as I can tell, a lot of data went through the websocket, so clearly `$body_bytes_sent` does not include data sent over a websocket.
> 
> [..]

Make sure to run a recent enough version of nginx, at least 1.7.11.

-- 
Sergey Kandaurov



More information about the nginx mailing list