Setting observer log levels

You can set the observer logging level to 'debug' (or a number of other levels) to troubleshoot in more detail.

About this task

To increase or decrease the log levels for a specific observer, you first obtain the observer's pod name, internal IP address, admin port and credentials. You then specify the required log level ('debug' in this example) before running the observer's load job and tailing the observer log.

Note: A log level of 'debug' logs all request or response operations to provide detailed diagnostic data.

The following task describes how to set the observer log levels to 'debug'. An OpenStack Observer example is provided.

Setting observer log levels to 'debug'

  1. Obtain the observer pod name.
oc get pod | grep [observer name]

Example output:

[release name]-topology-[observer name]-observer-dd845b66c-vqs82              1/1     Running     0             106m

Note: The observer pod name is [release name]-topology-[observer name]-observer-dd845b66c-vqs82. The value of dd845b66c-vqs82 will vary depending on the pod name.

  1. Use the observer pod name to obtain the observer's internal IP address.
oc describe pod [observer pod name] | grep IP

Example output:

IP: 10.254.21.131
IPs:
IP: 10.254.21.131

Note: Note down the IP address, which is the internal IP address.

  1. Use the observer pod name to obtain the observer admin port.
oc describe pod [release-name]-topology-[observer name]-observer-dd845b66c-vqs82 | grep Ports

Example output:

Ports: 9082/TCP, 9083/TCP
Host Ports: 0/TCP, 0/TCP

Note: In this example 9083 is the admin port of the observer. (The port with the odd number as the last digit is always the admin port.)

  1. Complete the following sub-steps.

    a. Obtain the base64 encoded string of [username]:[password]

    oc get secret | grep asm-credentials
    

    Example output:

    [release-name]-topology-asm-credentials                                    Opaque                                2      5d9h
    

    b. From the output above, run the following commands:

    oc get secret [release-name]-topology-asm-credentials --template={{.data.username}} | base64 -d
    
    oc get secret [release-name]-topology-asm-credentials --template={{.data.password}} | base64 -d
    

    Example commands and output:

    oc get secret aiops-topology-asm-credentials --template={{.data.username}} | base64 -d 
    asm-netcool-user
    
    oc get secret aiops-topology-asm-credentials --template={{.data.password}} | base64 -d 
    asmauto
    

    c. Encode to base64 format:

    echo "asm-netcool-user:asmauto" | base64
    

    Example output:

    YXNtLW5ldGNvb2wtdXNlcjphc21hdXRvCg==
    
  2. Specify the DEBUG log level. Run the following command:

oc exec -it [observer pod name] -- curl -k -X POST --header 'Authorization: Basic [base64 encoded string of username:password]' -d "logger=com.ibm.itsm.topology.observer.[observer name]&level=DEBUG" https://[internal IP address]:[observer admin port]/tasks/log-level
  • Replacing [observer pod name] and [internal IP address] in your environment. Note that [observer name] is the observer that is to be configured and [observer admin port] is the admin port of the observer.
  • The [base64 encoded string of username:password] is the base64 encoded string of [username]:[password].

OpenStack Observer example:

oc exec -it aiops-topology-openstack-observer-dd845b66c-vqs82 -- curl -k -X POST --header 'Authorization: Basic YXNtLW5ldGNvb2wtdXNlcjphc21hdXRvCg=='' -d "logger=com.ibm.itsm.topology.observer.openstack&level=DEBUG" https://10.254.21.131:9083/tasks/log-level

The following prompt should be visible in the console:

Configured logging level for com.ibm.itsm.topology.observer.[observer name] to DEBUG
  • In this example the package name com.ibm.itsm.topology.observer.[observer name] tells us that the observer package has been set to the DEBUG level.
  1. Run the observer load job and tail the observer log.
oc logs -f [release name]-topology[-observer name]-observer-dd845b66c-vqs82

Note: If set successfully to DEBUG, the DEBUG messages are now recorded in the observer log.

Example log entry (for the OpenStack Observer):

DEBUG [2024-07-30 06:46:13,200] [pool-12-thread-1] c.i.i.t.o.o.OpenStackRESTSession - [iZx9pZr] - getOpenStackClientAccessOrToken: Http Logging filter is 'false'