How to change the NCP log level to DEBUG without restarting the NCP processes in PKS
search cancel

How to change the NCP log level to DEBUG without restarting the NCP processes in PKS

book

Article ID: 298531

calendar_today

Updated On:

Products

VMware Tanzu Kubernetes Grid Integrated Edition

Issue/Introduction

Sometimes a more verbose mode of logging is required to troubleshoot and understand the problems associated with the NCP process. The default log level set for NCP is INFO. This article details how to change this to a different log level, such as DEBUG.

Environment


Resolution

Follow the steps below to change NCP log level. The example here covers how to switch to the DEBUG log level.

1. Identify the current NCP master and VM the process is running on:
bosh ssh -d service-instance_6a4aeb5c-b68f-43ac-94f0-3efdcc765bbf master "sudo /var/vcap/jobs/ncp/bin/nsxcli -c get ncp-master status" | grep "This instance is the NCP master"
master/8df6e9e2-962d-46af-b885-9e51cf9f22da: stdout | This instance is the NCP master
2. SSH to the VM identified in Step 1 and switch to root user:
bosh ssh -d service-instance_6a4aeb5c-b68f-43ac-94f0-3efdcc765bbf master/8df6e9e2-962d-46af-b885-9e51cf9f22da

master/8df6e9e2-962d-46af-b885-9e51cf9f22da:~$ sudo su -
3. Invoke the nsxcli. Check the current and available log levels:
master/8df6e9e2-962d-46af-b885-9e51cf9f22da:~# /var/vcap/jobs/ncp/bin/nsxcli

NSX CLI (NCP). Press ? for command list or enter: help
65bcb758-144d-42ff-a9a3-e02c4e6f7e0e> get ncp-log-level
NCP log level is NOTSET

65bcb758-144d-42ff-a9a3-e02c4e6f7e0e> set ncp-log-level
  NOTSET    Log level
  DEBUG     Log level
  INFO      Log level
  WARNING   Log level
  ERROR     Log level
  CRITICAL  Log level
4. Change the log level to one of the available log levels. In this example, it is DEBUG.
65bcb758-144d-42ff-a9a3-e02c4e6f7e0e> set ncp-log-level DEBUG