Gathering logs for a Kubernetes environment

The script gathers all logs for troubleshooting and diagnostics.

Before you begin

Review the log rotation recommendations in Deployment requirements.

About this task

When contacting IBM Support, several logs are required to assist in troubleshooting or diagnostics. The script gathers all the required logs using a single shell script.

Note: This article refers to third-party software and documentation that IBM does not control. As such, the software may change and this information may become outdated.


  1. Install the kubectl command line interface for Kubernetes, if it is not already installed.
  2. Configure kubectl to the Kubernetes cluster by entering the following commands:
    rm -fr $HOME/.kube
    mkdir -p $HOME/.kube
    scp root@{kubernetes_master_host}:/etc/kubernetes/admin.conf $HOME/.kube/config
  3. Download the script. It will be downloaded to the apicup project directory. Enter the following command:
    curl -s -o
  4. Add execute permissions to the script. Enter the following command:
    chmod +x
  5. Run the postmortem tool using the following command:
  6. (Optional) Currently, log generation is supported for Gateway and Portal subsystems. Specify either gateway or portal, or all subsystems. Enter the following arguments:
    All (generates logs for both Portal and Gateway subsystems): ./ --diagnostic-all
    Gateway: ./ --diagnostic-gateway
    Portal: ./ --diagnostic-portal
  7. (Optional) If there are errors when running the script, enter the following command:
    ./ --debug &>debug.log

    For more documentation on the script, see

    • Offboarding the logs to an external server is the recommended best practice for long term storage of log data.
    • If the logs do not cover far enough back in time, or conversely if they are too large, adjust the log retention size. For further information, see: