05-06-2018 12:09 PM
How to make WebDav server log the following:
?
05-07-2018 03:05 AM
"WebDav server" - I guess you are talking about the Alfresco Repository application and its WebDav endpoint, otherwise this question would have no point in this Alfresco-oriented community platform. And by "server log" I guess you are talking about the access logs, since only that does actually log the IP of the client.
The access logs cannot be enhanced in a way that they would log the user (unless external authentication is used), since they operate on the Tomcat level, and Tomcat is unaware of the Alfresco-internal authentication mechanisms / state. Only when external authentication is used (and user names transferred via the HTTP headers) could you adapt the access logs and simply print out the value of the HTTP header with the user name as part of the log message.
The alfresco.log - the application log of the Alfresco Repository - cannot be enhanced to print the user name in every log message, as that would require Alfresco to store such data in a NDC/MDC (nested / mapped diagnostic context) which it currently does not. But you could of course configure the various loggers of Alfresco to provide DEBUG output to log low-level events such as successful authentication and thus provide you with the means to extract the user name for a webdav request by cross-checking it with alfresco.log messages. Be aware though that setting loggers to debug will produce an immense amount of log output. One core logger you could use would be the one for org.alfresco.repo.security.authentication.AuthenticationUtil, which is at the core fo the user context handling.
With regards to the "file size" it depends in what context you want that information. In the context of a download you should already have that information in the access log concerning the size of the response. In the context of a specific WebDAV operation where the file isn't actually retrieved, only accessed, it depends on the implementation and if that implementation actually contains a log statement about that piece of information. As far as I can see, there is no (arbitrary) logging of the file size in any of the WebDAV method implementations (not even in the method for the actual GET / download).
Explore our Alfresco products with the links below. Use labels to filter content by product module.