Changing NSX for vSphere Manager logging behaviour using REST API

Author: Michael A. Haines & Prasenjit Sarkar

Here is an Interesting question that comes up from time to time, and is related to the NSX for vSphere Manager and logging, and in particular, what is the default logging behaviour of the NSX for vSphere Manager REST APIs (requests and responses). We sometimes here that folk are looking under the directory /var/log to find the log files for such interactions with the REST APIs! Sure, sounds logically right? Well, let us be crystal clear here, and start by saying that the NSX for vSphere Manager logging of REST APIs (requests and responses) does not occur under the directory /var/log.

So, is there actually a way to enable this logging capability of the REST APIs (requests and responses)?

REST API Thinking

Well, if only it were that straight forward! I do not know, though it is hight unlikely, if there is a LOG ‘ALL-APIs’ way to achieve this for NSX for vSphere in its entirety as a platform, but what I can tell you is specific to the NSX for vSphere Edge device APIs.

OK, so where does one begin?

  1. First,  you need to enable debug logging for the NSX for vSphere Edge device package. But that means there will be a lot more logs too! That also means that ALL the NSX for vSphere Edge device related activities will start logging in a debug level, so just be aware of this.

a. To enable this logging feature, perform the following using your favourite utility with which you interact with the REST API :

METHOD : POST
URL : /api/1.0/services/debug/loglevel/com.vmware.vshield.edge?level=debug
b. I am not aware of any option to just log the REST API requests and responses. However, you can use something like the following :
METHOD : POST
URL : /api/1.0/services/debug/loglevel/com.vmware.vshield.edge.*.facade?level=debug
So in summary, you will need to enable the following REST API calls if you want to enable logging :
METHOD : POST
URL : /api/1.0/services/debug/loglevel/com.vmware.vshield.edge.facade?level=debug
and
METHOD : POST
URL : /api/1.0/services/debug/loglevel/com.vmware.vshield.edge.*.facade?level=debug
There is no particular order to issuing the REST APIs above. Also be aware that if you reboot the NSX for vSphere Manager appliance after issuing the REST API requests above, these settings will be lost!

About Prasenjit Sarkar

Prasenjit Sarkar is a Product Manager at Oracle for their Public Cloud with primary focus on Cloud Strategy, Oracle Openstack, PaaS, Cloud Native Applications and API Platform. His primary focus is driving Oracle’s Cloud Computing business with commercial and public sector customers; helping to shape and deliver on a strategy to build broad use of Oracle’s Infrastructure as a Service (IaaS) and Platform as a Service (PaaS) offerings such as Compute, Storage, Java as a Service, and Database as a Service. He is also responsible for developing public/private cloud integration strategies, customer’s Cloud Computing architecture vision, future state architectures, and implementable architecture roadmaps in the context of the public, private, and hybrid cloud computing solutions Oracle can offer.

One thought on “Changing NSX for vSphere Manager logging behaviour using REST API

  1. Pingback: NSX Link-O-Rama | vcdx133.com