Viewing log files in Kubernetes

Procedure

To view log information from the command line for Docker images managed by Kubernetes:

  1. From the Kubernetes master node, log in as root, or if you enabled a non-root user, such as fciadmin, run the following command:
    kubectl get pods
    For example, if you have a system with the IBM FCI platform, FCAI, and FCDD installed, output is similar to the following:
    
    fcai-fci-alerts-insight-ar-5c6848b864-478lj          1/1       Running     0          1d
    fcai-fci-alerts-insight-db-6d95ccd9ff-tkq9f          2/2       Running     0          1d
    fcai-fci-alerts-insight-shiny-5ff9444c98-nqr92       1/1       Running     0          1d
    fci-case-manager-fci-messaging-66d58bf8d-7lflv       8/8       Running     0          1d
    fci-case-manager-fci-solution-5f54c79f58-t4d9b       3/3       Running     0          1d
    fci-cedm-datastore-6599d4b89d-vstzl                  2/2       Running     0          1d
    fci-cedm-integration-6cc78f976-ddqdn                 3/3       Running     0          1d
    fci-cedm-ui-5cbc77cc65-x5z4d                         1/1       Running     0          1d
    fci-common-scripts-bgq7n                             0/1       Completed   0          7d
    fci-common-ui-nginx-78b96966f5-s2v7f                 1/1       Running     0          1d
    fci-common-ui-nodejs-67d4c7cbc5-lj25j                1/1       Running     3          1d
    fci-logging-es-cfc5dcd6d-btxdl                       1/1       Running     0          1d
    fci-logging-fb-4mkq9                                 1/1       Running     0          1d
    fci-logging-fb-5fwhl                                 1/1       Running     0          1d
    fci-logging-fb-5kz2n                                 1/1       Running     0          1d
    fci-logging-fb-675cb                                 1/1       Running     0          1d
    fci-logging-fb-7x2dt                                 1/1       Running     0          1d
    fci-logging-fb-plppb                                 1/1       Running     0          1d
    fci-logging-fb-rrz42                                 1/1       Running     0          1d
    fci-logging-fb-srwsm                                 1/1       Running     0          1d
    fci-logging-kb-7fdbc7d45c-h4wpl                      1/1       Running     0          1d
    fci-logging-ls-6f44b4f7d-kl2dd                       1/1       Running     0          1d
    fci-rms-datastore-b7dbc5c5f-fdbmc                    2/2       Running     0          1d
    fci-rms-designstudio-7c7dfcd8f8-mbghv                3/3       Running     0          1d
    fci-rms-odm-76c68c797f-th2hs                         3/3       Running     0          1d
    fci-rms-odm-datastore-6d48868fc4-znqpk               2/2       Running     0          1d
    fci-security-audit-app-55f44d7c4d-56sd4              3/3       Running     0          1d
    fci-security-audit-datastore-6d44f65d8-spt64         2/2       Running     0          1d
    fci-security-auth-nodejs-77c84d6794-4brfk            0/1       Running     0          10h
    fci-security-auth-nodejs-77c84d6794-96z48            0/1       Running     0          10h
    fci-security-auth-redis-5f5cf95646-dv72q             1/1       Running     0          1d
    fcdd-fci-due-diligence-janusgraph-754df5f65c-tfzzc   1/1       Running     0          22h
    fcdd-fci-due-diligence-liberty-669d59d4f6-jmj62      1/1       Running     0          22h
    fcdd-fci-due-diligence-ml-5dc5744b-8x6ng             1/1       Running     0          22h
    fcdd-fci-due-diligence-mongodb-779f59687-z6zqm       1/1       Running     0          22h
    fcdd-fci-due-diligence-nodejs-56dc9f778-j4ltc        1/1       Running     0          22h
    fcdd-fci-due-diligence-redis-7f99557db7-5d44p        1/1       Running     0          22h
    fcdd-fci-due-diligence-wasbase-9474777d8-f49kg       1/1       Running     0          22h
    fcdd-fci-due-diligence-wex-78df6c9ff7-s7brr          1/1       Running     0          22h
    
  2. For containers that specify 1/1 in the Status column, run the following command:
    kubectl logs container_name
    For example:
    kubectl logs fcdd-fci-due-diligence-wasbase-9474777d8-f49kg
    Output is similar to the following:
    Starting server ...................
    ADMU0116I: Tool information is being logged in file
               /opt/IBM/WebSphere/AppServer/profiles/AppSrv01/logs/server1/startServer.log
    ADMU0128I: Starting tool with the AppSrv01 profile
    ADMU3100I: Reading configuration for server: server1
    ADMU3200I: Server launched. Waiting for initialization status.
    ADMU3000I: Server server1 open for e-business; process id is 107
    Jul 05, 2018 6:56:30 PM com.gdprRightToForget.GDPRService Consumer
    INFO: Initializing the Consumer
    SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
    SLF4J: Defaulting to no-operation (NOP) logger implementation
    SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
    Jul 05, 2018 6:56:31 PM com.gdprRightToForget.GDPRService Consumer
    INFO: Kafka Consumer Initialized
    Jul 05, 2018 6:56:31 PM com.gdprRightToForget.GDPRService Consumer
    INFO: Service::Consumer Starting and polling the Kafka Consumer Service
    
  3. For containers that specify more than one Ready container in the Status column, enter the following command:
    kubectl logs pod_name -c container_name
    For example:
    kubectl logs fci-case-manager-fci-solution-5f54c79f58-t4d9b -c message-log
    If you run kubectl logs pod_name, a list of containers in the pod is displayed. You can use one of the container names to get the logs for that specific container.
  4. Db2 containers specify datasource in the pod name. To view db2diag log files, enter the following command:
    kubectl logs pod_name db2diag-log
    For example, to view the CEDM Db2 log file in the prior example:
    kubectl logs fci-cedm-datastore-6599d4b89d-vstzl db2diag-log