On Sun, Jul 13, 2014 at 4:49 AM, Olivier Boudeville <olivier.boudeville@online.fr> wrote:

Apparently Yaws currently only supports writing its access logs in
"Common Log Format". Is there a plan to support as well the "Combined"
log format (a.k.a. NCSA combined/XLF/ELF)? That would allow tools like
awstats to extract more information.

This could be done via the logger_mod setting in the server configuration, which is described in the Yaws PDF documentation (http://yaws.hyber.org/yaws.pdf) as well as the yaws_config man page (http://yaws.hyber.org/yman.yaws?page=yaws.conf). I've included the text from the PDF doc below. Since Combined logging is the same as Common but with two extra fields, the implementation could probably just reuse much of yaws_log.


logger_mod = Module — It is possible to set a special module that handles access and auth logging. The default is to log all web server traffic to <Host>.access and <Host>.auth files in the configured or default logdir.
This module must implement the behaviour yaws_logger. Default value is yaws_log. The following functions should be exported:
– Module:open_log(ServerName, Type, LogDir) — When YAWS is started, this function is called for this virtual server. If the initialization is successful, the function must return {true, State} and if an error occurred, it must return false.
– Module:close_log(ServerName, Type, State) – This function is called for this virtual server when YAWS is stopped.
– Module:wrap_log(ServerName, Type, State, LogWrapSize) — This function is used to rotate log files. It is regularly called by YAWS and must return the possibly updated internal NewState.
– Module:write_log(ServerName, Type, State, Infos) – When it needs to log a message, YAWS will call this function. The parameter Infos is {Ip, Req, InHdrs, OutHdrs, Time} for an access log and {Ip, Path, Item} for an auth log, where:
∗ Ip — IP address of the accessing client (as a tuple).
∗ Req — The HTTP method, URI path, and HTTP version of the request (as an
#http_request{} record).
∗ InHdrs — The HTTP headers which were sent from the WWW client (as a #headers{}
∗ OutHdrs — The HTTP headers sent to the WWW client (as a #outh{} record).
∗ Path — The URI path of the request (as a string).
∗ Item – The result of an authentication request. May be {ok, User}, 403 or
{401, Realm}.
∗ Time — The time taken to serve the request, in microseconds.
For all of these callbacks, ServerName is the virtual server’s name, Type is the atom access or auth and State is the internal state of the logger.