Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Logging websocket requests to access log

Explaining what's going on now ...

Access log, aka NCSA Request Log is for logging of HTTP requests.
It has the distinction of logging not only the request details, but also the response details (status code, latency, size, etc).
This is done when the HTTP response is completed.

A websocket upgrade is an HTTP Request + a partial HTTP Response, after which it is no longer HTTP.
Said another way, when the WebSocket Handshake Response is completed, the connection is no longer HTTP.
The HTTP Response is never completed, hence no NCSA Request Log entry.

Now, if we add support for this, what would you expect in the access log?

What I would expect ...

GET request on a path, response code 101, latency at -1, size at -1. (is this actually useful?)

You would be missing the fact that its ws:// or wss:// (it could have been an http/2 upgrade for all that the access log format supports)

The negotiated websocket sub-protocol would also be absent in the access log. (we would probably need to add support forĀ https://github.com/eclipse/jetty.project/issues/113)


Joakim Erdfelt / joakim@xxxxxxxxxxx

On Thu, Jun 8, 2017 at 6:04 AM, anurag gupta <anurag.11feb@xxxxxxxxx> wrote:
Hi there,

I'm using Jetty 9.4.3.v20170317 for running a websocket server. I was able to configure request logging, that works great for normal HTTP requests. But it seems websocket upgrade requests are not logged at all.

How to configure it ?

--
Regards
Anurag

_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


Back to the top