Deploy log tailing/filtering
Summary:
The main deploy application now sends all structured log output to a
file under scap/log/{git-tag}.log which the new deploy-log utility
can tail and filter using a given free-form expression. By default the
latter utility will periodically scan the scap/log directory for new
files and immediately begin tailing them. It can also be given an
explicit log file to parse via the --file option or the latest log
file by using --latest; in this case, it will simply filter the entire
file for matching records and exit.
Free-form log.Filter expressions are hopefully simple enough to grok
by most users and general enough to be used with later implementations
of iscap log multiplexing. See deploy-log -h or log.Filter for
expression examples.
Introduced a base main.DeployApplication class which sets up some of
the most commonly referenced attributes of the derived deploy classes,
including the root deploy directory, scap directory, and log directory.
Depends on D15. Resolves T115137
Test Plan:
Tail behavior
- Run deploy-log {expr}.
- Run deploy in a separate terminal.
- Verify that deploy-log in the first terminal starts reading the new log file. It should say -- Opening log file: {file}.
- Verify that only log messages matching the given expression are output.
Latest log file behavior
- Run deploy.
- Run deploy-log -l {expr}
- Verify that only log messages from the latest log file matching the given expression are output.
Single log file behavior
- Run deploy a couple of times.
- Run deploy-log -f {log-file} {expr}.
- Verify that only log messages from the given log file matching the given expression are output.
Reviewers: demon, mobrovac, thcipriani, mmodell
Reviewed By: mmodell
Maniphest Tasks: T115137
Differential Revision: https://phabricator.wikimedia.org/D18