The first example below initializes flexible logging into the file <install-root><instance-directory>/logs/access.
This example shows the default format, which corresponds to the Common Log Format (CLF).
The first six elements of any log should always be in this format, because a number of log analyzers expect matching output.
Init fn="flex-init" access="$accesslog" format.access="%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] ’%Req->reqpb.clf-request%’ %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length%" |
This example will record the following items:
IP or host name, followed by the three characters “ - ”
User name, followed by the two characters “ [”
System date, followed by the two characters “] ”
Full HTTP request in quotes, followed by a single space
HTTP result status in quotes, followed by a single space
Content length
The second example initializes flexible logging into the file <install-root><instance-directory>/logs/extended.
Init fn=flex-init extended="<install-root><instance-directory> /logs/extended" format.extended="%Ses->client.ip% - %Req->vars.auth-user % [%SYSDATE%] \\"%Req->reqpb.clf-request%\\" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length% %Req->headers.referer% \\"%Req->headers.user-agent%\\" %Req->reqpb.method% %Req->reqpb.uri% %Req->reqpb.query% %Req->reqpb.protocol%" |
The third example shows how logging can be tuned to prevent request handling threads from making blocking calls when writing to log files Instead you can delegate these calls to the log flush thread.
Doubling the default size of the buffer-size and num-buffers parameters and lowering the value of the LogFlushInterval directive in magnus.conf to 4 seconds frees the request-handling threads to quickly write the log data.
Init fn=flex-init buffer-size=16384 num-buffers=2000 access=" /<install-root><instance-directory>/logs/access" format.access="%Ses->client.ip% - %Req->vars.auth-user% [%SYSDATE%] \\"%Req->reqpb.clf-request%\\" %Req->srvhdrs.clf-status% %Req->srvhdrs.content-length%" |