GitHubContribute in GitHub: Edit online

copyright: years: 2017, 2020 lastupdated: "2023-02-12"


Logging and tracing for SMS Gateway

Use the SMS Gateway log files to help diagnose problems in your deployment.

Configuring logging and tracing

Like other configuration, logging and tracing levels are configured as Docker environment variables, as described in Configuration environment variables for SMS Gateway.

The following Docker environment variables are used to configure the log and trace settings:

Table 1. Environment variables for configuring SMS Gateway logging and tracing
Environment variable Default Description
ENABLE_TRANSCRIPTION_MESSAGES false Set to true to enable transcription messages. For transcription messages to be logged, the LOG_LEVEL environment variable must also be set to finest. Note that when these messages are enabled, they are printed to the logs and might contain sensitive PHI, PII, and PCI DSS data.
LATENCY_REPORTING_THRESHOLD 1000 Threshold in milliseconds for reporting round-trip conversation latency.
LOG_LEVEL info The log level for SMS Gateway. Valid values from least information to most information are off, fatal, severe, warning, info, fine, finest, and all. Note that when set to fine, finest, or all, the logs might contain sensitive PHI, PII, and PCI DSS data.
LOG_MAX_FILES 5 The maximum number of log files, trace files, and exception summary log files. When this limit is reached, the oldest file is deleted and a new file is created. For example, when this variable is set to 5, SMS Gateway generates up to 5 message logs, 5 trace logs, and 5 exception summaries.
LOG_MAX_FILE_SIZE 100 The maximum size in megabytes (MB) that a log file can reach before a new file is created.
WLP_SKIP_UMASK false The server sets the log file permissions to deny access to other users. Set to true to give read access to other users.

Finding and viewing log files

The log files for the SMS Gateway container are in the /logs/ directory. This directory contains the messages.log file and verbose garbage collection logs, such as verbosegc.1.001.log. If the LOG_LEVEL is set to at least fine, the directory also contains the trace.log file, which contains additional details. If SMS Gateway encounters any exceptions, the exceptions are summarized based on the day that they occurred in log files in the ffdc subdirectory.

To copy the log files off of the container, run the following commands:

  • For Docker Engine:

    docker cp vgw-sms-gateway:/logs/messages.log .
    docker cp vgw-sms-gateway:/logs/trace.log .
    

  • For IBM Cloud Kubernetes Service, where the namespace is default and the pod name is pod1:

    kubectl cp default/pod1:logs .
    

Tip: Run the kubectl get pods command to find the pod name.

Configuring log file viewing permissions

During the Voice Gateway deployment, the server logs that are created don't give permissions to other users, -rw-r---. See Logging and tracing configuration.

If you want to create the server log files with read permissions for other users, you can set the WLP_SKIP_UMASK property in your deployment configuration file to true. This configuration allows the log file to be created with updated viewing permissions, -rw-r-r-.

WLP_SKIP_UMASK=true

Mounting a Docker volume for easier log collection

Instead of running docker cp commands to collect the logs from the container, you can mount a directory from the local file system to the container. The container writes the logs directly to the mounted directory, so you can view and collect the logs locally without needing to copy them from the containers each time.

To mount a local directory as a Docker volume, specify the directory mapping in host_directory:container_directory format on a volumes key in your docker-compose.yml file. In the following example, $PWD/logs/ denotes a logs directory in the current working directory, which is mounted to the logs directory in the container.

services:
  sms.gateway:
    ...
    volumes:
      - $PWD/logs/:/logs/

After you redeploy the container by running the docker-compose up command, the logs directory is created in the current working directory where the command is run. From there, the log files are created and updated.

Setting the log file language

If you want to read the log files in a language other than English, you can choose a different language by changing the locale in the containers by setting both of the following environment variables:

Table 3. Environment variables for locale and language
Environment variable Default
LC_ALL en_US.UTF-8
LANG en_US.UTF-8

To learn more about locales and these variables, see Locale on the Ubuntu wiki.

For example, the following variables set the log file language to Spanish:

LC_ALL=es_ES.UTF-8
LANG=es_ES.UTF-8

You can choose from the following supported languages:

Table 4. Supported languages
Language Character set value
Brazilian Portuguese pt_BR.UTF-8
French fr_FR.UTF-8
German de_DE.UTF-8
Italian it_IT.UTF-8
Japanese ja_JP.UTF-8
Spanish es_ES.UTF-8
Simplified Chinese zh_CN.UTF-8
Traditional Chinese zh_TW.UTF-8

Setting the log file time zone

You can change the time zone of the messages in the log file by configuring the time zone for the container. To configure the time zone, set the TZ environment variable to the corresponding zone name from the International Assigned Numbers Authority (IANA) Time Zone Database. For example, the following configuration sets the time zone to America/New_York.

TZ=America/New_York

For more information about the IANA time zones, see Time Zone Database.