NAME [Toc] [Back]
samlog_viewer - a tool for viewing and saving the SAM logfile
SYNOPSIS [Toc] [Back]
/usr/sam/bin/samlog_viewer [-s mmddhhmm[[cc]yy]] [-e mmddhhmm[[cc]yy]]
[-l SDVC] [-u user] [-o ofile] [-t] [-n] [file]
DESCRIPTION [Toc] [Back]
The samlog_viewer command enables the viewing of part or all of the
SAM logfile (or another file containing data in the same format) at
varying levels of detail. This tool is run by SAM whenever the View
SAM Log option is chosen. It can also be run independently of SAM, in
either interactive or noninteractive mode.
The samlog_viewer command executes in either interactive or
noninteractive mode, depending on the options given. In
noninteractive mode, samlog_viewer filters the source file and writes
the resulting data either to stdout or to a destination file. In
interactive mode, samlog_viewer displays a graphical user interface
enabling you to try different combinations of filtering, save one or
more versions of the source file to other files, scroll back and forth
among the logfile entries, etc.
Under no circumstances is samlog_viewer destructive to the contents of
the SAM logfile (or whatever source file is specified by file). The
contents of the source file are filtered and displayed (or output)
according to the settings of the available filters. Multiple
instances of samlog_viewer can be run simultaneously without harmful
Filters [Toc] [Back]
samlog_viewer supports three types of filters: level of detail,
date/time, and user filters. These filters can be used in combination
to provide highly selective logfile viewing.
The level of detail filters control how much detail is displayed. The
SAM logfile may contain entries of many different types. The entry
types currently supported are: summary, detail, verbose, error, and
note. The level of detail filters display some or all of these entry
types, depending on which filter is chosen. The level of detail
Summary Displays only the higher level messages.
These include summary, error, and note
(warnings, other entries worthy of special
attention) entry types.
Detail Includes Summary level of detail, and adds
detail log entries. If no level of detail is
specified, this is the default.
Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
Verbose Includes Detail level of detail, and adds
verbose log entries.
Commands Only Displays only the literal commands that were
executed. These commands may include HP-UX
commands as well as SAM commands and scripts.
The date/time filters are used to ask for entries written since a
specific date/time, before a specific date/time, or both.
The user filters are for viewing only those entries written by a
particular user. If invoked with the -u option, its argument is used
as the user whose entries should be shown. If -u is not specified,
then the value of the environment variable SAM_RESTRICTED_USER is used
as the name of the user. If neither -u or SAM_RESTRICTED_USER is
present, then no user filtering is done and entries from all users are
shown. If both -u and SAM_RESTRICTED_USER are in effect, the -u
option overrides the setting of the environment variable.
If user filtering is selected, either by the SAM_RESTRICTED_USER
environment variable or by the -u option, samlog_viewer displays only
entries made by that user and disallows any changes to the user
filtering. This is useful for allowing nonprivileged users to run
samlog_viewer and see only those entries that pertain to them.
Otherwise, samlog_viewer allows the user filtering to be changed, or
completely disabled, from its interactive filtering screen.
Options [Toc] [Back]
The following options enable you to set up filtering and other
attributes. If samlog_viewer runs interactively, these attributes may
also be set and modified in the various supported menus and displays.
The available options are:
-s mmddhhmm[[cc]yy] The -s option sets the start date/time
filter to the date/time given by its
argument. The date/time is specified in
the same way as it is for the date
command (see date(1)):
mm Month specified as a two digit
number (e.g., 08).
dd Day specified as a two digit
hh Hour specified as a two digit
number (24-hour clock form).
mm Minute specified as a two digit
Hewlett-Packard Company - 2 - HP-UX 11i Version 2: August 2003
cc Century minus one. cc is
optional when specifying the
yy The last two digits of the
desired year. If this is not
specified, the current year is
Note: To specify a year in two
digits, the valid ranges are 70-
99 (20th century) and 00-37 (21st
To specify a year in four digits,
the valid range is 1970-2037.
If no start time is given, the beginning
of the log is used as the start time.
-e mmddhhmm[[cc]yy] The -e option sets the end date/time
filter to the date/time given by its
argument. The date and time is
specified as described above for the -s
option. If no end time is given, then
an end date/time of infinity (no end
time) is used.
-l SDVC The -l option sets the desired level of
detail. One of the letters SDVC must be
specified as the required argument. The
level of detail is set as follows:
S = Summary
D = Detail
V = Verbose
C = Commands Only
If the -l option is not specified, the
Detail level of detail is used by
-u user The -u option sets the user filter to
the user name or user ID specified by
user. Only entries logged by this user
are displayed. If the -u option is
omitted, entries logged by all users are
displayed by default.
-o ofile The -o option causes the filtered output
to be written to the output file ofile.
Hewlett-Packard Company - 3 - HP-UX 11i Version 2: August 2003
The -o option implies the -n option
described below. If ofile is -, the
output is written to stdout. If -o is
omitted, the output is written to either
stdout (if -n is specified) or to the
interactive samlog_viewer display (if -n
-t The -t option enables automatic
timestamping. If specified, each log
entry is tagged with the time of day at
which it was written. Timestamping is
disabled by default.
-n The -n option forces noninteractive
behavior. If specified, samlog_viewer
runs noninteractively, using the default
or specified values for all supported
options and source/destination files.
file Specifies the name of the file from
which log data is read. The format of
the data in the specified file must be
the same as that used for raw SAM
logfile data. If omitted, the SAM
logfile is read. If file is -, stdin is
read and samlog_viewer runs
noninteractively. If given, file must
be the last argument specified on the
EXAMPLES [Toc] [Back]
Capture the current contents of the SAM logfile using default
filtering, and put into the file sam.out:
samlog_viewer -n >sam.out
The following example does the same thing:
samlog_viewer -o sam.out
View only the commands executed by SAM on behalf of user tom, between
8am June 5, 1994 and 10pm August 14, 1994, and view the data
samlog_viewer -s 060508001994 -e 081422001994 -lC -u tom
Noninteractively read data from stdin, timestamp it, and save the
result in a file called stdin.out:
Hewlett-Packard Company - 4 - HP-UX 11i Version 2: August 2003
cat datafile | samlog_viewer -t -o stdin.out -
Do the same as above, but instead have the data appear on stdout:
cat datafile | samlog_viewer -t -o - -
cat datafile | samlog_viewer -tn -
Hewlett-Packard Company - 5 - HP-UX 11i Version 2: August 2003
FILES [Toc] [Back]
/var/sam/log/samlog SAM logfile.
/var/sam/log/samlog.old Archived version of samlog, created when
the logfile is automatically trimmed by
SAM when its size becomes too large. Its
contents are included in the log entries
read by samlog_viewer.
/tmp/LFV_pid Temporary files used by samlog_viewer.
Hewlett-Packard Company - 6 - HP-UX 11i Version 2: August 2003 [ Back ]