HP-UX Reference (11i v1 05/09) - 1M System Administration Commands A-M (vol 3)
k
kl(1M) kl(1M)
• name of the log file used by write-to-disk.
• maximum file size of the log file used by write-to-disk, together with the minimum file
size available for the current session of write-to-disk.
• number of messages not written to file (could be due to the lack of memory or small size
of the circular buffer).
• list of all subsystems currently specified in the
/etc/nettlgen.conf
file and the
associated message class(es) logged for each subsystem.
USAGE
When to Use Kernel Logging
Mission critical systems should have KL always enabled. Failing to enable Kernel Logging causes diagnos-
tic information about any suspicious events that might occur on the system to be lost. The recommended
classes to capture are Disaster, Error and Warning. Use
kl -l w all command to do so.
To minimize Kernel Logging’s impact on a running system, use the
kl -l e all command to set
all kernel subsystems to capture error-level log messages only.
Log File Management
The write-to-disk facility uses two files to hold logging information. The base name of the log files is
specified in
/etc/nettlgen.conf
. The default base log file name is /var/adm/kl ; see
nettlgen.conf(4). The most current data is always in the file with suffix
.KLOG0. If the size of the
.KLOG0 file reaches a user-defined maximum, Kernel Logging renames the .KLOG0 file to
.KLOG1,
overwriting the previous contents of the
.KLOG1 file, then continues writing messages to the .KLOG0 file.
(Specify maximum log file size in
/etc/nettlgen.conf
or use the -s option.)
The Kernel Logging facility has a protection feature for saving old log files. When write-to-disk starts and
encounters old log files that contain messages collected during a prior run of the system when a panic
occurred (thus, the log files may contain important information about the panic), then log files are not
overwritten. Instead, write-to-disk first attempts to move the old log files to the default crash directory
(typically
/var/adm/crash/crash.ID
, where ID is a numeric counter). If the move fails, then write-
to-disk tries to rename the log files with the prefix
OLD, allowing the files to remain in the same directory.
For example, if write-to-disk finds an old log file named
/var/adm/kl.KLOG0, it first tries to move the
file into the default crash directory. If this move is not successful, write-to-disk then tries to move the file
to
/var/adm/OLDkl.KLOG0
.
If both attempts to save old log files fail, the write-to-disk component is not started. To preserve the mes-
sages in the old log files, do one of the following:
• If possible, eliminate the conditions that caused both attempts to move the old log files to fail.
• Manually move old log files.
• Using the
nettlconf command, modify the file /etc/nettlgen.conf
to specify a different
log file name for write-to-disk logging.
Once the problem is corrected, start write-to-disk again. If successful, the Kernel Logging facility will
notify you about the move of the old log files.
RETURN VALUE
kl exits with one of the following values:
0 Operation was successful
1 kl command aborted due to error(s)
EXAMPLES
1. Enable the default Kernel Logging facility.
kl -e
2. Display the information about the Kernel Logging facility.
kl -i
3. Change level to log disaster, error and warning messages for all subsystems.
kl -l w all
Section 1M−−396 Hewlett-Packard Company − 3 − HP-UX 11i Version 1: September 2005