samlog
Name
samlog - Collects, formats, merges, and displays System Automation for Multiplatforms-related logs of a live domain
or previously collected ctsnap
data.
Synopsis
samlog [-n Node[, Node...]] [-s Source[, Source...]]
[[-d] -t Offset{d|h|m|s}|YYYY-MM-DD[.hh[:mm[:ss]]]
[+Duration{d|h|m|s}|, YYYY-MM-DD[.hh[:mm[:ss]]]]
|all]
[--dir CtsnapDirectory --dom DomainName]
[-r | -e EyecatcherRegexp] [--nocomp] [–T] [–h|--help]
Description
The samlog command collects data from log files, for example trace or
trace summary files. Log files can have various sources in the System Automation for Multiplatforms domain or come from previously
collected ctsnap
data. The time frame for which logs are retrieved can be
restricted if you specify either relative time spans or absolute dates. If you enabled trace
file spooling, the spooled files are regarded as well.
Unless you use the –r option, the logs are formatted to a common format:
- Headers are removed.
- Date and time format is unified. The following format is used for the time-stamp:
YYYY-MM-DD hh:mm:ss:mmmmmm
- YYYY: year
- MM: month
- DD: day
- hh: hour
- mm: minutes
- ss: seconds
- mmmmmm: microseconds fraction
- Information about the source of the log entries is added to the actual log entries by using the
format
SourceCharacterNodeName)
. TheSourceCharacter
is one of the characters that are listed in the description of the -s option. - Actual log entry.
If multiple logs are retrieved, they are merged by their
time stamp. To ensure the correct order of merged log entries, system
time offset differences are compensated. System time offsets of ctsnap
data
cannot be determined and are not compensated.
- Node name
- Compensated system time that is offset between local host and node.
- List of all sources that are retrieved by this node.
- Concurrent calls of samlog in the same cluster or on the same
ctsnap
data can fail due to errors caused byrpttr
attempting to log the processed trace files. - It is required to enable ithread support of the Perl distribution that is
used by RSCT. If a message like
Can't locate threads.pm
is displayed, update Perl on every system of your cluster to supportithread
.
Options
- -n Node[,Node...]
- Use option
–n
to specify the nodes from which you want to collect logs. Make sure that the node names are the same than the node names listed bylsprnode
. The node list consists of comma-separated values without blanks. By default, all nodes that are online in the domain or all nodes that are located in thectsnap
directory are selected. - -s Source[,Source...]
- Use option
–s
to specify the sources from which logs are retrieved. The source list consists of comma-separated source characters or names without any blanks:- R or
IBM.RecoveryRM
– to selectIBM.RecoveryRM
(selected by default) - G or
IBM.GblResRM
– to selectIBM.GblResRM
(selected by default)
- R or
- -d
- Use option
–d
to produce detailed output. If this option is set, the complete traces of the resource managers are collected. It is required to use the–t
option to restrict the queried time frame, because this option retrieves much more data. By default, this option is not set and the trace summaries of the resource managers are collected. - -t Offset{d|h|m|s}|YYYY-MM-DD[.hh[:mm[:ss]]][+Duration{d|h|m|s}|,YYYY-MM-DD[.hh[:mm[:ss]]]]|all
- Use option
–t
to specify if the time frame is queried either relative to the current time or absolute. A time frame is defined by start and end time. If you specify only the start time but no end time, then the time frame takes until current time.- relative
- Specify the start date in the past by defining an offset followed by a measuring unit: d
- days, h - hours, m - minutes, s - seconds. Optionally, specify the end date by appending
+
followed by the duration and a measuring unit.Example:- 2d, 60 s, 1d+1 h
- absolute
- Specify the start date by a portion of a date. Optionally, specify the end date by a
portion of a date, which is separated by a comma. Examples:
- 2010-06-23.08:29:30
- 2010-06-23.08
- 2010-06-23.12, 2010-06-23.12:30
- mixed
- You can use a combination of relative and absolute. Examples:
- 2010-06-23.08:29:00+60 s
- 12d,2010-06-22
If the
–t
option is used with valueall
, everything is retrieved. If no–t
option is specified, the default is the last day (1d). - --dir CtsnapDirectory
- Use option
--dir
to apply samlog to previously collectedctsnap
data. TheCtsnapDirectory
must contain subfolders for each cluster node. These subfolders are named exactly like the node names that are listed bylsprnode
from which thectsnap
data was collected. They must contain the extracted or uncompressed or non-taredctsnap
data.Combine the
--dir
option with--dom
. - --dom DomainName
- The command
ctsnap
stores the logs of all domains that are defined on a node. Use option-dom
in combination with the--dir
option to specify from which domain you want to retrieve logs. The valid domain names can be found as symbolic links in the/var/ct
subfolder of the node folder. - -r
- Use option
–r
to retrieve a raw log. If this option is set, reformatting of the log is skipped and the original log is displayed. This option can be used only in combination with a single node which is specified with the–n
option and a single source which is specified with the–s
option. The–r
option cannot be combined with the–e
option. If the–r
option is not set, logs are formatted. - -e EyecatcherRegexp
- Use option
–e
to filter logs for specific eye catchers. TheEyecatcherRegexp
has Perl regular expressions syntax. The following example provides a limited description of the Perl expression syntax:Wild cards: .
=any, \w=word char, \d=digit, \s=white space
Powers:
*=0.., +=1.., ?=0..1, {n}=n, {n,}=n.., {n,m}=n..m
Grouping, alternative:
AB=A followed by B, (A|B)=[A|B]=A or B
Only those entries are displayed that match theEyecatcherRegexp
.Note:The- The time-stamp, node and source prefix are not part of the entry that is checked
against the
EyecatcherRegexp
. - Duplicate any backslash in the
EyecatcherRegexp
value to pass the backslash properly tosamlog
.Example:
- Instead of
\s
write\\s
- Instead of
–e
option cannot be used in combination with the–r
option. - The time-stamp, node and source prefix are not part of the entry that is checked
against the
- --nocomp
- Use option
--nocomp
to disable compensation of system time differences on the nodes from which logs are retrieved. If this option is set, the original times are preserved. If this option is not set, the system time offsets of the node where samlog runs and the nodes which provide logs are determined and compensated to ensure the correct order of entries in the merged logs. - -T
- Use option
–T
to write samlog traces toSTDERR
. - -h | --help
- Use option
–h
to display the usage syntax.
Exit Status
- 0
- The command ran successfully.
- 2
- Command stopped due to an error or timeout in an underlying command.
- 3
- Command stopped due to user which specify an invalid option.
- 4
- Command stopped due to user which specify a bad option value.
Security
This command requires root authority, or a user ID with appropriate permissions. For more information, see Setting up non-root user Ids for the command line interface.
Examples
- To retrieve the merged
trace.summaries
ofIBM.RecoveryRM
andIBM.GblResRM
on all online nodes for the last day, enter:samlog
- To display the raw and detailed trace of
IBM.GblResRM
on node1 within the last 15 minutes, enter:samlog -n node1 -s G -d -r -t 15m
- To create a file that is called
RecSum
in the current directory which contains the merged trace summaries ofIBM.RecoveryRM
on node1 and node2 for 10 minutes started 1 hour ago, enter:samlog -n node1,node2 -s R -t 1h+10m 1>RecSum
- To display the samlog trace and create a file
/tmp/sum0815
with thetrace.summaries
ofIBM.RecoveryRM
andIBM.GblResRM
on all online nodes that are related to Res0815 between start date 06/21/10 10:00:00 and end date 06/21/10 12:30:00, enter:samlog -e "Res0815" -t 2010-06-21.10,2010-06-21.12.30 -T 1>/tmp/sum0815
- To display the merged
trace.summaries
ofIBM.RecoveryRM
andIBM.GblResRM
on all nodes of the domainprod
from a previously collectedctsnap
directory/tmp/ct_data
, enter:samlog -t all --dir /tmp/ct_data --dom prod
- To produce a samlog trace file
/tmp/samlog.trace
, for example, for finding out why the specified options are not accepted, enter:samlog -T 2>/tmp/samlog.trace
Files
- /usr/sbin/rsct/bin/samlog
- Location of the samlog command.
See Also
The ctsnap command.