Sending and Collecting Logs¶
log send
Single or multiple log files can be sent to a URI destination using log send <URI> <logfile> and log send <URI> <prefix> respectively.
The URI must match the URI specification detailed under the Network URI Specification topic.
An example of an email URI is
mailto:user@server.com
. All email communication requires notify emailrelay to be configured with the IP address of your mail relay.When using log send to a
scp
andsftp
destination, no port should be specified.For example:
$ log send sftp://usr:[email protected]/ install/voss-deviceapi_install.script-20150819.log
log send output
The output of a VOSS-4-UC CLI command can be sent to a URI destination using
log send output <URI> <CLI command>
For example:
$ log send output sftp://usr:[email protected]/ app status File transfer successful - 172.21.21.122:None/VOSS_1558945096-combined_logs.tar.gz
The transferred file (archive file format example:
var/log/users/platform/<command>.<yyyymmdd>
) then contains the output of the CLI command.Note that only VOSS-4UC CLI commands will generate a file with command output. For example, while the command was ls media can be run from the VOSS-4-UC CLI prompt, it is not a VOSS-4-UC command and the contents of the transferred
lsmedia.<yyyymmdd>
file will becommand not found: ls
.log sendnewer
Log files newer than a certain date can be sent using log sendnewer <yyyy-mm-dd> <URI>. If the remote URI destination requires a password, it will prompt for the password.
A passwordless scp session can be enabled by generating keys locally with keys create and then sending the local keyset to the remote destination with keys send user@<hostname>.
log collect
Use log collect to collect logs into an archive file. Both system and transaction logs can be collected. Mandatory and optional parameters are available to refine the log collection.
The syntax is:
log collect start <start-time> [include <logs|db|all>] [end <end-time>] [limit]
Note
- If the command is run from a web proxy node, only the system logs can be collected.
- The
start
andend
parameters do not affect date range of system logs - they only apply to the date range of transaction collection logs.
The
start
parameter is mandatory.The
end
parameter is optional.If omitted, the transaction collection logs are collected up to the current time.
The
<start_time>
and<end_time>
date value format can be:+%Y-%m-%d_%H:%M:%S
, for example2016-01-10_00:00:00
+%Y-%m-%d
, for example2016-01-10
- Year-Month-Day format without leading zeroes, for example:
2016-1-10
The
include
parameter is optional. If not used, both transaction collection and system logs are collected.If used, valid options are:
logs
: collect system application and install log files from the/var/log
directory.Log files with the following file wild cards are collected:
/var/log/syslog* /var/log/dmesg* /var/log/psmem*
Log files in the following directories are collected:
/var/log/nginx /var/log/sysstat /var/log/platform /var/log/process /var/log/voss-deviceapi /var/log/provision /var/log/install /var/log/mongodb
You can inspect the list of collected files with the log list command and a search parameter, for example log list install/ to see all the install log files.
This option excludes the transaction collection. The
start
andend
parameters do not affect this collection.db
: collect transaction collection logs and exclude the system logs. By default, this includes:- transaction activity log records (
TRANSACTION.json.gz
) - the detailed content of transactions as seen on the GUI in the Log transaction list (
TRANSACTION_LOG.json.gz
).
- transaction activity log records (
all
: both transaction collection and system logs are collected
The
limit
option only affects the transaction collection logs. It specifies that the detailed transaction collection logs (TRANSACTION_LOG.json.gz
) are not included.This parameter is usually used if the logs are required for a task such as performance analysis, but not for debugging. Typically, all collection logs are needed for debugging.
An example of the console input and output of the command is shown below:
$ log collect start 2019-08-27 include db limit 2019-08-27T08:16:02.140+0000 connected to: localhost:27020 2019-08-27T08:16:02.148+0000 exported 3 records Output saved to media/logs.VOSS.2019-08-27_08-16-01.tar.gz
The log file archive is of the format:
logs.<hostname>.<timestamp>.tar.gz
, where<timestamp>
is the time that the collection was requested, in the format:%Y-%m-%d_%H-%M-%S
. This file is created in themedia/
directory.The log file archive can then for example be fetched with scp, for example:
scp platform@VOSS:media/logs.VOSS.2019-08-27_08-16-01.tar.gz