.. _sending-and-collecting-logs: Sending and Collecting Logs --------------------------- .. index:: log;log send .. index:: log;log list .. index:: log;log send output .. index:: log;log sendnewer .. index:: log;log collect .. index:: keys;keys create .. index:: keys;keys send .. index:: notify;notify emailrelay .. _19.3.2|EKB-4964: .. _19.3.4-PB3|EKB-8449: * **log send** Single or multiple log files can be sent to a URI destination using **log send ** and **log send ** 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`` and ``sftp`` destination, no port should be specified. For example: :: $ log send sftp://usr:pass@172.21.21.122/ 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 ** For example: :: $ log send output sftp://usr:pass@172.21.21.122/ 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/.``) 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.`` file will be ``command not found: ls``. * **log sendnewer** Log files newer than a certain date can be sent using **log sendnewer **. 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@**. * **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 [include ] [end ] [limit]** .. note:: * If the command is run from a web proxy node, only the system logs can be collected. * The ``start`` and ``end`` 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 ```` and ```` date value format can be: * ``+%Y-%m-%d_%H:%M:%S``, for example ``2016-01-10_00:00:00`` * ``+%Y-%m-%d``, for example ``2016-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`` and ``end`` 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``). * ``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. .. important:: * The *log collect* command with default parameters should not be run in parallel on all nodes. * Transaction database data should not be collected from secondary nodes. So the commands issued on a primary would be different from that on secondaries, e.g.: Primary ``log collect start 2020-04-10 end 2020-04-14`` Secondaries ``log collect start 2020-04-10 include logs end 2020-04-14`` 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...tar.gz``, where ```` is the time that the collection was requested, in the format: ``%Y-%m-%d_%H-%M-%S``. This file is created in the ``media/`` 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** .. |VOSS-4-UC| replace:: VOSS-4-UC .. |Unified CM| replace:: Unified CM