<HTML ><HEAD ><TITLE >Logging</TITLE ><META NAME="GENERATOR" CONTENT="Modular DocBook HTML Stylesheet Version 1.63 "><LINK REL="HOME" TITLE="PHHTTPD HTTP Accelerator HOWTO" HREF="index.html"><LINK REL="PREVIOUS" TITLE="Configuration File" HREF="configuration.html"><LINK REL="NEXT" TITLE="Run Time Facilities" HREF="runtime.html"></HEAD ><BODY CLASS="SECT1" BGCOLOR="#FFFFFF" TEXT="#000000" LINK="#0000FF" VLINK="#840084" ALINK="#0000FF" ><DIV CLASS="NAVHEADER" ><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TH COLSPAN="3" ALIGN="center" >PHHTTPD HTTP Accelerator HOWTO</TH ></TR ><TR ><TD WIDTH="10%" ALIGN="left" VALIGN="bottom" ><A HREF="configuration.html" >Prev</A ></TD ><TD WIDTH="80%" ALIGN="center" VALIGN="bottom" ></TD ><TD WIDTH="10%" ALIGN="right" VALIGN="bottom" ><A HREF="runtime.html" >Next</A ></TD ></TR ></TABLE ><HR ALIGN="LEFT" WIDTH="100%"></DIV ><DIV CLASS="SECT1" ><H1 CLASS="SECT1" ><A NAME="LOGGING" >4. Logging</A ></H1 ><P ><SPAN CLASS="QUOTE" >"All kids love log!"</SPAN ></P ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN139" >4.1. Overview</A ></H2 ><P > phhttpd maintains log buffers for each log it writes to. Logged events are put in these buffers at reporting time rather than being immediately written to disk. These logs are written as they are filled during normal operation, or at regular intervals. This greatly reduces the performance impact of keeping detailed logs. </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN142" >4.2. Configuration</A ></H2 ><P > phhttpd keeps interesting logs on a virtual server granularity. You can specify which logs you wish to keep by including an entity in the log section of a virtual server for each source you wish to log. There is an entity for each source of logging, and attributes to that entity define where it is logged. It looks something like this:<TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" > <logs> <LOGSOURCE mode=OCTALMODE file=PATH> ... </logs></PRE ></TD ></TR ></TABLE > </P ><P ><TT CLASS="VARNAME" >mode</TT > is the octal permissions mode of the file that is to be opened. As it is parsed by dumb routines, a leading 0 is highly recommended. <TT CLASS="VARNAME" >file</TT > is the file to which the logged events will be written. The LOG_SOURCE is one of: <DIV CLASS="INFORMALTABLE" ><A NAME="AEN149" ></A ><P ></P ><TABLE BORDER="0" CLASS="CALSTABLE" ><TBODY ><TR ><TD ALIGN="LEFT" VALIGN="TOP" >access</TD ><TD ALIGN="LEFT" VALIGN="TOP" >Successfully answered requests</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" >agent</TD ><TD ALIGN="LEFT" VALIGN="TOP" > The value given in the 'User-Agent' HTTP request header</TD ></TR ><TR ><TD ALIGN="LEFT" VALIGN="TOP" >referer</TD ><TD ALIGN="LEFT" VALIGN="TOP" > The string given in the 'Referer' HTTP request header</TD ></TR ></TBODY ></TABLE ><P ></P ></DIV > </P ></DIV ><DIV CLASS="SECT2" ><H2 CLASS="SECT2" ><A NAME="AEN161" >4.3. Format and Strange Behaviour</A ></H2 ><P > phhttpd log entries are contained with a single line in a text file. They contain the time the log entry was written, an opaque token that is associated with the connection that caused the log entry, followed by the actual entry. </P ><P >The contents of the 'referer' and 'agent' log entries is simply the string that was given with the header. The contents of the 'access' log is a little more interesting. It has the decoded relative URL that was asked for, followed by the total bytes that were transfered, and the time in seconds that it took to transfer. <TABLE BORDER="0" BGCOLOR="#E0E0E0" WIDTH="100%" ><TR ><TD ><PRE CLASS="PROGRAMLISTING" > 387f7a45 387f7a45800210ac8910500 /index.html - 2132 0 </PRE ></TD ></TR ></TABLE > is an entry from an 'access' log. </P ><P >The first field is the time in seconds since the Unix epoch, a.k.a. <TT CLASS="VARNAME" >time_t</TT >. The second field is associated with the client connection that caused the log entry. It is constant for the duration of the connection, and is written to all the logs entries, of whatever type, that are generated. This allows a log parser to do more complete connection granularity analysis. As it happens, this opaque token is currently built up of the time the client was connected, its remote and local network address, etc, but these values most _not_ be parsed as they may change in the future. </P ><P > Entries generated by a thread will be written in chronological order. If, however, multiple threads are sharing an output file the resulting entries may not be written in chronological order. It is up to the parsing programs to use the 'time' field to sort by, if they care about chronological order. </P ></DIV ></DIV ><DIV CLASS="NAVFOOTER" ><HR ALIGN="LEFT" WIDTH="100%"><TABLE WIDTH="100%" BORDER="0" CELLPADDING="0" CELLSPACING="0" ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" ><A HREF="configuration.html" >Prev</A ></TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" ><A HREF="index.html" >Home</A ></TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" ><A HREF="runtime.html" >Next</A ></TD ></TR ><TR ><TD WIDTH="33%" ALIGN="left" VALIGN="top" >Configuration File</TD ><TD WIDTH="34%" ALIGN="center" VALIGN="top" > </TD ><TD WIDTH="33%" ALIGN="right" VALIGN="top" >Run Time Facilities</TD ></TR ></TABLE ></DIV ></BODY ></HTML >