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. The default from address is platform@<hostname>. A from outgoing address for the email relay can also be configured with notify emailfrom <from: email address> - see: Enable Health Monitoring.

    When using log send to a scp and sftp 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 Automate 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 Automate CLI prompt, it is not a VOSS Automate command and the contents of the transferred lsmedia.<yyyymmdd> file will be command 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

    • Run cluster check before log collect to have the latest cluster check information logged to cluster_check.log.

    • 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 <start_time> and <end_time> 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

        • For a <start_time>, if the value is entered as +%Y-%m-%d, then the value used will be the start of that day, in other words: +%Y-%m-%d_00:00:00.

        • For an <end_time>, if the value is entered as +%Y-%m-%d, then the value used will be the end of that day, in other words: +%Y-%m-%d_23:59:59.

      • 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 database server, system, application and install log files:

        • db_server_status.log - database server status: the output of mongo db.serverStatus()

        • disk_usage.log - disk usage: output of command df -h

        • top.log - current CPU consumption per process: output of command top -b -n 1 -o +%CPU

        • sar<DD> - today’s system activity by the system activity reporter sar: output of sa2 -A

        • db_collection_stats.log - database collection stats: output of CLI command voss db_collection_stats all

        • db_index_stats.log - database index stats: output of CLI command voss db_index_stats

        • 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
          /var/log/voss-portal
          /var/log/billing-data-extract (if available)
          /var/log/nbi-api (if available)
          /var/log/m2uc-nx (if available)
          

          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, including those for patches, for example:

          platform@VOSS:~$ log list install
          install/voss-deviceapi_install.script-20210709.log
          install/disable-platform-password-expiry_patch.script-20210709.log
          install/selenium_install.script-20210709.log
          install/support_install.script-20210709.log
          install/mongodb_install.script-20210709.log
          install/nginx_install.script-20210709.log
          install/snmp_install.script-20210709.log
          ...
          

          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).

        • worker transaction queue activity log records (WORKER_QUEUE.json.gz)

        This option can only be added when the command is run on a unified or database node.

      • all: both transaction collection (db) and system logs (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.<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 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