w - log watcher
Contents
w
- log watcher#
Overview#
Each agent generates a rich digest of information written to its log file. This utility will sift through these logs and extract the key bits of information that summarize what it did and how it finished. It can also be used to monitor a running job to check on it’s progress.
The principle of operation is that each agent appends to a log file for that day. The name of the log file includes a prefix of 2 to 5 characters that identifies the agent, followed by a date string. This utility will scan through a single log file and report on each agent instance it encounters.
Log file prefix#
Each agent generates log files with a designaed prefix. These logs are written
into the CncOp application log directory Spool/Logs
. To see a
comprehensive list of agent prefixes, use the cncopjobs -t x
command.
Requesting old logs#
By default, this utility will report on the most recent days log for the
designated agent type. An administrator can request older logs by specifying
the --daysago
option (defaults to 0 which means today). Keep in mind, when
asking for older logs, the utility counts days available, which can be
different then calendar days. For example, when looking at logs for a job that
runs weekly, if you ask for --daysago 2
, you will see two weeks ago.
System paginator#
This utility offers the option to open an agent’s daily log file in the system’s paginator. It will scan the system path for one of several paginator options. It will prefer pagers in the following order
The optional ‘PAGER’ environment variable
If the system finds the less
pager, it will used it’s enhanced options.
Note
If no system paginator can be found, then the pager related functions cannot be used.
Launching pagintor#
Due to the fact that w
is written in python, it introduces a problem
with the ccs3updater
keeping the cncop3 system up-todate. While w
is
running, ccs3updater cannot safely update the code. A multiplatform solution
requires two different approaches.
On POSIX, w
will exec(3) the paginator
in the foreground of the terminal. By using exec, python will no longer be
running which will allow the ccs3updater
to work smoothly.
On WINDOWS, w
will run the pagintor in a new console. The console will run
detached from the calling python process in it’s own process group and python
will end, which will allow ccs3updater
to work smoothly. If you are
using w
in WINDOWS and you’d prefer to not open a new console, use the
--fg
option to keep the paginator in the current console.
Note
w
will detect if it is running on WINDOWS in a CBS
session and
automatically enable the --fg
option.
Command line options#
usage: w.py [-h] [--debug] [-c CONFIG] [--tell] [--less] [--work]
[--finished] [--fg] [--peekexclude] [--daysago DAYSAGO] logprefix
Required positional arguments#
- logprefix#
Identifies the log file prefix to report on. Each agent has a designated prefix, typically 2 to 5 characters long. To see the list of currently support prefix codes, run
cncopjobs -t x
. The logprefix is treated case-insensitive.
Optional argument:#
- -h, --help#
Display help and exit
- -d, --debug#
Generate debug output.
- -c CONFIG, --config CONFIG#
Alternate configuration file.
- --tell, -t#
Display the name of the agent log file that would be used, and exit.
- --less, -l#
Invoke the system paginator on the log file.
- --work, -w#
Display the WORK summary line. Only available for those agents with discreet PEEK steps. This option is primarily intended for the
backupagentnq
agent.
- --finished, -f#
Show formatted job finished messages.
- --fg#
Keep paginator in foreground. This option is primarily intended for Windows sessions running within CBS.
- --peekexcluded, -x#
Suppress PEEK-EXCLD messages. This option is only available with
less
.
- --daysago DAYSAGO, -b DAYSAGO#
Paginate log from DAYSAGO
Example usage#
Here are several examples of how to invoke w
To launch the paginator on the most recent backupagentcifs
log:
w -l CIFS
To launch the paginator on yesterday’s backupagentcifs
log:
w -b 1 CIFS
To monitoring the progress of backupagentnq
:
w NQ
To see the WORK line of the BackupAgentNQ
:
w -w NQ
To see how backupagentrsync
completed:
w -f RSYNC
To use the more
paginator to view the most recent backupagentdq
log
on Windows:
C:\>set PAGER=more.com
C:\>w DQ
Note
In the case of WINDOWS, you must specify the file extension of the pager executable when setting the PAGER environment variable.