Description
Jetty version
9.4.x
Description
If someone wants to move away from CustomRequestLog NCSA format to one that is slightly tweaked but still includes HTTP version (as seen in the NCSA format), then they have to drop the HTTP version portion.
To explain, this started with the stackoverflow question at https://stackoverflow.com/questions/67635098/request-param-is-logged-in-access-log-with-embedded-jetty-server-of-spring-boot
They were using the old-school extended NCSA requestlog and format.
Which outputted the first line in the request POST /myAPI/v2/customer/message?myID=123&messageText=hello HTTP/1.0
, but they wanted to strip away the query string.
The default format for Extended NCSA in CustomRequestLog is %{client}a - %u %t "%r" %s %O "%{Referer}i" "%{User-Agent}i"
, of which the "%r"
portion logs the first line of the request, if they wanted to simulate the Extended NCSA format, but without the query string, they cannot, as HTTP Version is not an available format option, the best they can do is "%m %U"
without the HTTP Version portion.
Activity
lachlan-roberts commentedon May 28, 2021
@joakime I think
%H
should do what you are looking for.So you should replace the
"%r"
portion with"%m %U %H"
.joakime commentedon May 28, 2021
@lachlan-roberts I think you are correct.
Consider this a documentation issue then, we need to probably provide more explanation of that
%H
format option.Perhaps even documentation on the
%r
option to show the equivalent in other options for the same output?lachlan-roberts commentedon May 28, 2021
I don't think its possible to reproduce
%r
exactly with another format string. There is no percent code forrequest.getOriginalURI()
so it is currently not possible.joakime commentedon May 28, 2021
Couldn't you use
%m %U%q %H
to be the equivalent of%r
?lachlan-roberts commentedon May 28, 2021
You could almost do it with
%m %U%q %H
but then you won't have the fragment string and it doesn't look like there is a percent code for that.And also
getOriginalURI()
says it is before customization/rewrite.Issue #6330 - Improve javadoc for CustomRequestLog %H
Issue #6330 - Improve javadoc for CustomRequestLog %H
Fixes #6330 - CustomRequestLog is missing HTTP version format option.
Fixes #6330 - CustomRequestLog is missing HTTP version format option. (…
Fixes #6330 - CustomRequestLog is missing HTTP version format option.
Fixes #6330 - CustomRequestLog is missing HTTP version format option. (…