Configuring logging drivers

Follow the instructions in this topic to configure logging drivers, which can help you get information from running containers and services.

About this task

All software containers that are provided in IBM Z® Operational Log and Data Analytics write log data exclusively to standard output and standard error. This approach to logging allows the container management tool to take control of the log output and to manage it according to its own built-in facilities.
Every container management tool offers several different logging drivers. Review the container management tool of your choice, either Docker or Podman, for the logging drivers provided by it. The following two drivers are available in both Docker and Podman:
json-file
By default, the software containers in IBM Z Operational Log and Data Analytics are configured to use the simplest possible logging driver - json-file. The json-file logging driver caches container logs as JSON internally.
If you use this out-of-box logging driver, you don't need to install any other prerequisites. However, data that is logged with this driver do not persist beyond the lifetime of the container, and therefore might not be suitable for long-term log retention. Also, this driver does not offer any log rotation or log compression.
journald
The journald logging driver sends container logs to the journald facility, which allows container logs to be viewed and managed along with all other application output logged via journald. This driver includes log rotation and log compression.
If you want to use the journald driver for logging of the software containers, follow the instructions to complete the steps.

Procedure

  1. Change into the <ZOA_HOME> directory.
  2. Open the configuration file zoa_env.config in a text editor.
  3. Locate the property LOGGING_DRIVER and set its value to journald.
  4. Save and exit the file.
  5. Run the following commands to restart all the container-based services:
    Podman:
    ./bin/podmanManageZoa.sh down
    ./bin/podmanManageZoa.sh up  
    Docker:
    ./bin/dockerManageZoa.sh down
    ./bin/dockerManageZoa.sh up  
    Note: The support of this feature is limited by the journalctl subsystem on Linux® and the support provided in Docker and Podman. For example, on RHEL 8, the journald driver can only be used with Podman if the containers are run under the root user ID. Likewise, access to log data via journalctl is managed differently by different Linux distributions and might only be available to root and user IDs with elevated privileges.
  6. To view the log output of a container in journald, use the prefix CONTAINER_NAME. Multiple CONTAINER_NAME prefixes can be combined in a single command to view log output from multiple containers.
    Podman:
    • Example for viewing the ZOA common gateway service:
      sudo journalctl -f CONTAINER_NAME=gateway
    • Example for viewing the ZOA common gateway and authentication services:
      sudo journalctl -f CONTAINER_NAME=gateway CONTAINER_NAME=auth
    Docker:
    • Example for viewing the gateway service:
      sudo journalctl -f CONTAINER_NAME=zoa-gateway
    • Example for viewing the ZOA common gateway and authentication services:
      sudo journalctl -f CONTAINER_NAME=zoa-gateway CONTAINER_NAME=zoa-auth
  7. To access the logging data that is produced by the software containers directly through the container management tool, run the following command:
    Podman:
    podman logs
    Docker:
    docker logs