Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > by-pkgid > 965e33040dd61030a94f0eb89877aee8 > files > 7472

howto-html-en-20080722-2mdv2010.1.noarch.rpm

<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
>&#13;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.&#13;</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN142"
>4.2. Configuration</A
></H2
><P
>&#13;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"
>&#13;&#60;logs&#62;

	&#60;LOGSOURCE mode=OCTALMODE file=PATH&#62;

	...

&#60;/logs&#62;</PRE
></TD
></TR
></TABLE
>&#13;</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"
>&#13;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"
>&#13;The string given in the 'Referer' HTTP request header</TD
></TR
></TBODY
></TABLE
><P
></P
></DIV
>&#13;</P
></DIV
><DIV
CLASS="SECT2"
><H2
CLASS="SECT2"
><A
NAME="AEN161"
>4.3. Format and Strange Behaviour</A
></H2
><P
>&#13;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.  &#13;</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"
>&#13;387f7a45 387f7a45800210ac8910500 /index.html - 2132 0&#13;</PRE
></TD
></TR
></TABLE
>

is an entry from an 'access' log.&#13;</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.&#13;</P
><P
>&#13;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.&#13;</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"
>&nbsp;</TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>Run Time Facilities</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>