Chapter 6. Logging

Log messages advise you of the status of VCP-Recorder. The preset logging messages are associated with levels of warning, from informational messages, to messages critical to the running of VCP-Recorder. When problems occur, log messages are your first clue for tracking down the problem.

The major tasks involved in managing logging are discussed in the following sections:

Configuring Logging

Logging is configured with the start-up options for VCP-Recorder, /usr/vtr/bin/vvtr. These options are specified in the VCP-Recorder daemon (vvtrd) configuration file, /usr/vtr/config/vtrd.conf. vvtrd starts, monitors, and, if necessary, restarts vvtr, VCP-Recorder's main executable.

To modify the VCP-Recorder server logging settings, edit vtrd.conf and add or modify the logging options specified in the vvtr command string.

For example, to log all log messages up to the Debug2 level in the server log file, /var/adm/vtr/logs/vtrlog, the vvtr entry in vtrd.conf should read:

vvtr * * * * TERM “/usr/vtr/bin/vvtr -f2

For more information about vtrd.conf, see “Starting VCP-Recorder at Boot Time”.

Logging Options

Whether entered at the command line, or as a line of text in /usr/vtr/config/vtrd.conf, the VCP-Recorder daemon command takes the logging options described in Table 6-1.

Table 6-1. Logging Options

Flag

Variable

Definition

-f

log-level

Set the maximum log message priority for the log file to Info + log-level. The default log-level is 0, meaning all log messages up to and including Info priority are written to the log file.

-F

log-file

Write the log file to log-file. The default is /var/adm/vtr/logs/vtrlog. For more information, see “Logging Outputs”.

-l

log-options

Omit specified log message fields from log messages. For more information, see “Log level Options”.

-s

log-level

Set the maximum log message priority for SYSLOG to Info + log-level. The default is 0, meaning all log messages up to and including Info priority are written to SYSLOG. For more information, see “Log Levels”.

-t

 

Truncate the log file when it is opened. If this option is not specified, the new log messages are appended to the existing log file.

-v

log-level

Set the maximum log message priority for stdout to Info + log-level. The default is 0, meaning all log messages up to and including Info priority are written to stdout.

The -v option is useful only when the VCP-Recorder server, /usr/vtr/bin/vvtr, is started alone. When the server is started by the VCP-Recorder daemon, as it is when the vtrstart command is used, all stdout log messages are discarded.

Log Levels

-s sets the severity level of the messages written to the server log, vtrlog. Table 6-2 shows the VCP-Recorder log severity levels and codes, which are listed in decreasing order of severity.

Table 6-2. Log Levels

Severity Level

Severity Code

Description

Emergency

X

Panic condition.

Alert

A

A condition that should be corrected immediately, such as a corrupted system file.

Critical

C

A critical condition that has system-wide impact, such as a hard device error; immediate action is required.

Error

E

A problem that needs correcting, but does not require immediate action.

Warning

W

Possible problem, but could be a transient problem that corrects itself.

Notice

N

Condition that might require attention, but isn't an error condition.

Info

I

Informational message.

Debug

n

Information message that normally is of use only to engineers for debugging; may be Debug1, Debug2, or Debug3, with Debug3 producing the most amount of debugging information.

The following is an example of a message that has a severity code of 2 (Debug2 severity level). The message was written on the 14th day of the month at the time that is shown in the message, and the ID of the process that wrote the message is 8254:

2 14-22:23:50.316766  8254 mvcp/ninety9 <-- 100 VTR Ready

The following is an example of a warning message that was written to the log because the user who started the vvtr program did not have root permission:

W 02-09:00:04.677265 3459 Must be root to ensure reliable operation

Log level Options

-l sets the log options, which control the format of the messages written to the log. If this option is omitted, each message contains the severity code, a time stamp, the process ID, and the text of the message.

The following may be specified for this option:

  • -l l, do not include the severity code in each log message.

  • -l t, do not include the time stamp in each log message.

  • -l p, do not include the process ID in each log message.

Level, process ID, and time stamp are always omitted from the log messages in the system log, SYSLOG.

Logging Outputs

-F specifies where logging is output. Output options include:

  • stdout

  • server log file (/var/adm/vtr/logs/vtrlog)

  • system log (/var/adm/SYSLOG)

By default, critical log messages go to the system log, SYSLOG. These messages are also logged to the server log file (/var/adm/vtr/logs/vtrlog) as are all messages up to and including the Info level.

Informational log messages go to the server log file, vtrlog.

Log messages go to stdout by default only when you start VCP-Recorder manually. In that case, the log messages go to the window in which VCP-Recorder was invoked.

If VCP-Recorder is invoked automatically at boot time, you should configure the logging level for the server log file (-f option) as desired to help troubleshoot VCP-Recorder problems.

Managing Log Rollover

Log rollover is the practice of saving the current log file and restarting logging into an empty log file. Rollover avoids the problem of having a list of log messages too long to easily handle.

SYSLOG is rolled over automatically by a cron job. Often the cron job:

  1. Renames the current log file.

  2. Sends a SIGHUP. (killall -HUP syslogd) command to the logging daemon, which causes it to start logging into a new log file.

Managing vtrlog

vtrlog is the only server log file you need to manage. In general, to manage it, you build a cron script that mimics the actions of the SYSLOG cron script. The details of the cron script are left to the discretion of the system administrator; VCP-Recorder has no requirements for rollover parameters.

When the VCP-Recorder daemon (vtrd) or server (vvtr), receives a SIGHUP signal, it reopens the server log file. If you rename or remove the server log file and then send a SIGHUP signal, logging starts in a new, empty log file.

VCP-Recorder Log Messages

Each VCP-Recorder log message has the following format:

c  dd-hh:mm:ss.mmmmmm  pppp  <log message>

where

  • c is the severity code of the message.

  • dd is the day of the month.

  • hh:mm:ss.mmmmmm is a time stamp that indicates when the message was written.

  • pppp is the process ID of the process that wrote the message to the log.

  • log message is the actual text message.