Setting observer log levels (OCP)

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.

Procedure

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.
  2. 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.
  3. 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.)
  4. Complete the following sub-steps.
    1. Obtain the base64 encoded string of [username]:[password]
      oc get secret | grep asm-credentials
      Example command with output:
      oc get secret | grep asm-credentials
      noi-165-topology-asm-credentials                                    Opaque                                2      5d9h
    2. 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 command that uses the release name `noi-165` with output:
      oc get secret noi-165-topology-asm-credentials --template={{.data.username}} | base64 -d
      asm-netcool-user
       
      oc get secret noi-165-topology-asm-credentials --template={{.data.password}} | base64 -d
      asmauto
    3. Encode to base64 format:
      Example that uses the username and password obtained in the previous step:
      echo "asm-netcool-user:asmauto" | base64
      Example command with output:
      echo "asm-netcool-user:asmauto" | base64
      YXNtLW5ldGNvb2wtdXNlcjphc21hdXRvCg==
  5. 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 noi-165-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.
  6. 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'

What to do next

Tip:

A number of log levels are available, in addition to 'debug'.

You can change your current log levels to the following values (INFO is the default log level):
  • OFF
  • ERROR
  • WARN
  • INFO
  • DEBUG
  • TRACE
  • ALL

When setting the log level, you may want to consider disk usage. The ALL log levels uses the most space.