Extracting application logs from pods

After you deploy the Sterling™ Order Management System Software by using the Operator, extract the application logs from the pods.

View and extract the console logs

To view the console logs from a particular pod, run the following command:
oc logs <pod name> -n <namespace>

To extract logs, pipe or redirect the output to a local file.

Redirecting the log files outside the containers

Browse to the <persistent volume> directory and create the logs base directory.

Note: Ensure to provide write permissions to the <persistent volume>/logs directory for its owner group.
  • Liberty logs
    • To redirect the Liberty logs outside the pod, use the following environment variable. For more information, see serverProperties parameter.
          envVars:
            - groupName: EnvironmentVariables
              propertyList:
                LOG_DIR: /shared/logs/${OM_POD_NAME}
                LIBERTY_LOG_DIR: /shared/logs/${OM_POD_NAME}

      As the value of the preset OM_POD_NAME environment variable is set to the pod name, the logs are redirected to the <persistent volume>/logs/<OM_POD_NAME>/<Logfile> directory.

    • To redirect the Liberty dumps outside the pod, set the following environment variable:
          jvmArgs:
            - groupName: BaseJVMArgs
              propertyList:
                - -DJVM=${OM_POD_NAME}
                - -DLOG_DIR=${LOG_DIR}
                - -XX:HeapDumpPath=${LOG_DIR}
                - -Xdump:heap+java:events=user          
                - -Xgcpolicy:gencon
                - -Xverbosegclog: ${LOG_DIR}/${OM_POD_NAME}_verbosegc_%Y%m%d.%H%M%S.%pid.txt
      

      The output directory of liberty is defaulted to <persistent volume>/logs/<OM_POD_NAME>/<Logfile>.

    • To provide a custom location for the verbose gc logs in Liberty, use server properties to deploy the Operator. For more information, see serverProperties parameter.
      • -verbose:gc
      • -Xverbosegclog:/shared/logs/$(OM_POD_NAME)/gclogs/%Y%m%d.%H%M%S.%pid.txt

        The verbose gc logs are copied to the <persistent volume>/logs/<OM_POD_NAME>/gclogs directory. The log file name contains date, time, and Liberty Java process ID.

  • Agent logs
    • To provide a custom location for the agent server gc log, use server properties to deploy the Operator. For more information, see serverProperties parameter.
      • -verbose:gc
      • -Xverbosegclog:/shared/logs/$(OM_POD_NAME)/gclogs/%Y%m%d.%H%M%S.%pid.txt

      The verbose gc logs are written to the <persistent volume>/logs/<OM_POD_NAME>/gclogs directory. The log file name contains date, time, and Liberty Java process ID.

    • To redirect the Sterling Order Management System Software application logs outside the pod, complete the following steps:
      1. Before you deploy the Operator, ensure that the Sterling Order Management System Software images are customized to use a custom log4j configuration. For more information, see Customizing log4j configuration.

        Specify the log file location as follows:
        /shared/logs/${LOG_ARG}/sci.log.

      2. In the Operator, specify the jvmArgs parameter in the omserver.servers[] as follows:
        -DLOG_ARG=$(OM_POD_NAME)
      3. While customizing the log4j configuration, if you choose differential extensibility, ensure to add the appropriate customer override properties before you deploy the Operator.

        The Sterling Order Management System Software application logs are copied to the <persistent volume>/logs/<OM_POD_NAME> directory.