You probably need to modify the access log template in the application properties like this:
server.tomcat.accesslog.pattern=%h %l %t %u "%r" %s %b
where %u
is the authenticated remote user (see example here ).
UPD Perhaps this is not enough, since the generic template already contains the %u
parameter. In this case, I would recommend two additional steps:
1) Put the username in the query session parameter, for example:
request.getSession().addAttribute("username", user.getName());
2) Add the following parameter to the access log template: %{username}s
server.tomcat.accesslog.pattern=%h %l %t %u %{username}s "%r" %s %b
which should accept an attribute named username
from HttpSession
, as described here .
source share