<CHAPTER ID="ZADM-LOGGING"><?dbhtml filename="zadm-logging.html">
<TITLE>Logging and Statistics</TITLE>

<PARA>
<EMPHASIS>
This text has been copied from other sections and will change...
</EMPHASIS>
</PARA>


<!-- ..........................................................

<SECT1 ID=zadm-logging-checking-log-files>
<TITLE>Checking the Log Files</>

<PARA>
Start ZMailer:
<SCREEN>
 $MAILBIN/zmailer
</SCREEN>
</PARA>

<PARA>
Keep an eye on the log files (<FILENAME>$<VARNAME>LOGDIR</>/router</>,
<FILENAME>$<VARNAME>LOGDIR</>/scheduler</>), the
<FILENAME CLASS="DIRECTORY">$<VARNAME>POSTOFFICE</>/postman/</>
directory for malformed message files, and
<FILENAME CLASS="DIRECTORY">$<VARNAME>POSTOFFICE</>/deferred/</>
in case of resource problems.
</PARA>

</SECT1>

<SECT1 ID=zadm-logging-trimdown>
<TITLE>Trimdown of Logging</>

<PARA>
Once satisfied that things appear to work, you may want to trim down
logging: there are 4 kinds of logging to deal with:
<ITEMIZEDLIST>
<LISTITEM><PARA>
router logs, usually kept in <FILENAME>$<VARNAME>LOGDIR</>/router</>.
This is the stdout and stderr output of the router daemon.
If you wish to turn it off, invoke router with a ``<OPTION>-L /dev/null</>''
option, i.e. change the <COMMAND>zmailer</> script.
Alternatively, modify the <FUNCTION>log()</> function in the configuration
file, or its invocations.
</PARA></LISTITEM>

<LISTITEM><PARA>
scheduler logs, usually kept in <FILENAME>$<VARNAME>LOGDIR</>/scheduler</>.
Same as router.
</PARA></LISTITEM>

<LISTITEM><PARA>
general mail logs, usually kept in syslog files, depending on how
you have configured the syslog utility (<FILENAME>/etc/syslog.conf</>).
All ZMailer programs log using the <CONSTANT>LOG_MAIL</> facility code
for normal messages.
You can deal with this specifically in your <COMMAND>syslogd</>(8)
configuration file on systems with a 4.3bsd-based syslog.
The following reflects the recommended configuration on SunOS 4.0:
<SCREEN>
  mail.crit   /var/log/syslog
  mail.debug  /var/log/mail
</SCREEN>
</PARA>
<PARA>
For pre-4.3bsd-based syslogs, you may want the syslog log file to be just
for important messages (e.g. <CONSTANT>LOG_NOTICE</> and higher priority), and have
a separate file for informational messages (<CONSTANT>LOG_DEBUG</> and up).
</PARA></LISTITEM>

<LISTITEM><PARA>
By default, the postmaster will <EMPHASIS>not</> receive a copy of
all bounced mail; this can be turned on selectively by simply editing
the various canned forms used to create the error messages.
These forms are located in the <VARNAME>FORMSDIR</>
(<FILENAME CLASS="DIRECTORY">proto/forms/</> in the distribution,
or <FILENAME CLASS="DIRECTORY">$<VARNAME>MAILSHARE</>/forms/</>
when installed).
You should review these in any case to make sure the text is appropriate
for your site.
</PARA></LISTITEM>
</ITEMIZEDLIST>
</PARA>

</SECT1>
........................................................ -->

<SECT1 ID=zadm-logging-scheduler-perflog>
<TITLE><COMMAND>Scheduler</> Statistics Log</>

<PARA>
The  statistics log reports condenced performance oriented
information in following format:
<INFORMALTABLE ROWSEP=0 COLSEP=0>
<TGROUP COLS=6>
<COLSPEC ALIGN=LEFT>
<COLSPEC ALIGN=LEFT>
<COLSPEC ALIGN=CENTER>
<COLSPEC ALIGN=CENTER>
<COLSPEC ALIGN=LEFT>
<COLSPEC ALIGN=LEFT>
<THEAD>
<ROW ROWSEP=1>
 <ENTRY ALIGN=LEFT>timestamp</>
 <ENTRY ALIGN=LEFT>fileid</>
 <ENTRY ALIGN=CENTER>dt1</>
 <ENTRY ALIGN=CENTER>dt2</>
 <ENTRY ALIGN=LEFT>state</>
 <ENTRY ALIGN=LEFT>$channel/$host</>
</ROW>
</THEAD>
<TBODY>
<ROW>
 <ENTRY>812876190</>
 <ENTRY>90401-2</>
 <ENTRY>0</>
 <ENTRY>5</>
 <ENTRY>ok</>
 <ENTRY>usenet/-</>
</ROW>
<ROW>
 <ENTRY>812876228</>
 <ENTRY>90401-1</>
 <ENTRY>0</>
 <ENTRY>7</>
 <ENTRY>ok</>
 <ENTRY>usenet/-</>
</ROW>
<ROW>
 <ENTRY>812876244</>
 <ENTRY>90401-1</>
 <ENTRY>0</>
 <ENTRY>1</>
 <ENTRY>ok</>
 <ENTRY>local/gopher-admin</>
</ROW>
<ROW>
 <ENTRY>812876244</>
 <ENTRY>90401-1</>
 <ENTRY>0</>
 <ENTRY>5</>
 <ENTRY>ok</>
 <ENTRY>smtp/funet.fi</>
</ROW>
<ROW>
 <ENTRY>812876559</>
 <ENTRY>90401-1</>
 <ENTRY>0</>
 <ENTRY>21</>
 <ENTRY>ok</>
 <ENTRY>smtp/utu.fi</>
</ROW>
</TBODY>
</TGROUP>
</INFORMALTABLE>
where the fields are:

<VARIABLELIST>
<VARLISTENTRY><TERM><OPTION>timestamp</></><LISTITEM><PARA>
The original spoolfile <EMPHASIS>ctime</> (creation time) stamp in decimal.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>fileid</></><LISTITEM><PARA>
Spoolfile name after the router has processed it.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>dt1</></><LISTITEM><PARA>
The time difference from spoolfile ctime to 
scheduler control file creation by the router.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>dt2</></><LISTITEM><PARA>
The time difference from scheduler file <EMPHASIS>ctime</> to
the delivery that is logged on.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>state</></><LISTITEM><PARA>
What happened?  Values: ok, ok2, ok3, error, error2, expiry
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>$channel/$host</></><LISTITEM><PARA>
Where/how it was processed.
</PARA></LISTITEM></VARLISTENTRY>
</VARIABLELIST>
</PARA>

</SECT1>

<SECT1 ID=zadm-logging-syslogged-log-formats>
<TITLE>Syslogged Log Formats</>

<PARA>
At <EMPHASIS>syslog</> facility the system logs also material,
if it has so been configured.
</PARA>

<PARA>
Different subsystems do different logs, they are described below.
</PARA>

<SECT2 ID=zadm-logging-syslog-from-smtpserver>
<TITLE><COMMAND>Smtpserver</>'s Syslog Format</TITLE>

<PARA>
The <EMPHASIS>smtpserver</> may log in multiple formats:
<VARIABLELIST>
<VARLISTENTRY>
<TERM>INFO: connection from ...</TERM>
<TERM>WARN: refusing connection from ...</TERM>
<TERM>INFO: accepted id ... into freeze..</TERM>
<TERM>INFO: TASPID accepted from...</TERM>
<LISTITEM><PARA>
where TASPID: A spool-id that is valid throughout message lifetime
in the system, and should be long-term unique, even.  (Per system.)
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY>
<TERM>EMERG: smtpserver policy database problem...</TERM>
<TERM>ERR:  MAILBIN unspecified in zmailer.conf</TERM>
<LISTITEM><PARA></PARA></LISTITEM>
</VARLISTENTRY>
</VARIABLELIST>
</PARA>

</SECT2>

<SECT2 ID=zadm-logging-syslog-from-router>
<TITLE><COMMAND>Router</>'s Syslog Format</TITLE>

<PARA>
The <EMPHASIS>router</> does <FUNCTION>syslog</>() in following format:
</PARA>

<PARA>
<SYNOPSIS>taspid: from=&lt;addr&gt;, rrelay=smtprelay, size=nnn, nrcpts=nnn, msgid=str</SYNOPSIS>
</PARA>

<PARA>
Where:
<VARIABLELIST>
<VARLISTENTRY><TERM><OPTION>taspid</></><LISTITEM><PARA>
The TA-SPOOL-ID &mdash; A spool-id that is valid throughout message lifetime
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>from=</></><LISTITEM><PARA>
the envelope source address
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>rrelay=</></><LISTITEM><PARA>
the message ``rcvdfrom'' envelope header reports.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>size=</></><LISTITEM><PARA>
Total message size in bytes (envelope+headers+body)
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>nrcpts=</></><LISTITEM><PARA>
Number of recipients for this message
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>msgid=</></><LISTITEM><PARA>
The ``Message-ID:'' header content
</PARA></LISTITEM></VARLISTENTRY>
</VARIABLELIST>
</PARA>

</SECT2>

<SECT2 ID=zadm-logging-syslog-from-transport-agents>
<TITLE>Transport Agent's Syslog Format</TITLE>

<PARA>
The transport agents log in following format:
</PARA>

<PARA>
<SYNOPSIS>taspid: to=&lt;addr&gt;, delay=dd, xdelay=xx, mailer=mm, relay=rr (wtt), stat=%s msg</SYNOPSIS>
</PARA>

<PARA>
Here the fields are:
<VARIABLELIST>
<VARLISTENTRY><TERM><OPTION>taspid</></><LISTITEM><PARA>
The ta-spool-id &mdash; A spool-id that is valid throughout message lifetime
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>to=</></><LISTITEM><PARA>
Destination address in whatever form the transport agent uses.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>delay=</></><LISTITEM><PARA>
Delay from message arrival to the system to this logging moment
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>xdelay=</></><LISTITEM><PARA>
Delay during this processing attempt &mdash; tells how much time <EMPHASIS>this</>
time was spent to process the message.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>mailer=</></><LISTITEM><PARA>
Tells what ``channel'' was used.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>relay=</></><LISTITEM><PARA>
Reports on which host the message is relayed thru (``wtthost''), and for
SMTP, also (in parenthesis) what was the relay's IP address.
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM><OPTION>stat=</></><LISTITEM><PARA>
What status was achieved: ok*, delayed, failed, ...
<EMPHASIS ROLE=BOLD>CHECK!</>
</PARA></LISTITEM></VARLISTENTRY>

<VARLISTENTRY><TERM>msg</><LISTITEM><PARA>
Arbitrary text line from whatever system is out there.
</PARA></LISTITEM></VARLISTENTRY>
</VARIABLELIST>
</PARA>

</SECT2>
</SECT1>
</CHAPTER>
