Configuring Syslog for NSX for vSphere Controller using REST API

Happy New Year folks. Its been a little more than 6 months since I wrote my last article. Well, as you have seen in my last post that I switched my role within VMware and with that changed my host country as well. That took a while to get me settled abroad and then was busy in settling down a bit. As of today my core focus is on SDN and within VMware its NSX for vSphere mainly. So I have dedicated a page for this SDN and will post a lot of articles from now on including guest articles by one of my close friends and industry’s well known Networking & Security expert Michael Haines.

In this article I am going to talk about how to enable Syslog and configure a remote syslog for the NSX for vSphere controllers. Yes you heard it right, as of today the only “supported” method of “Configuring syslog server for VMware NSX for vSphere 6.x Controllers” is using the REST API. The request body to configure this is fairly straight forward, as there are only a few elements that can be configured.

Before we begin configuring the Syslog service using the REST API, let us take a brief look at what REST client(s) are available to enable us to quickly perform this configuration programatically. We can use Advanced REST Client extension for Chrome browser. Its pretty easy to add this to your Chrome browser and use it. You can also use the RESTClient Addon for Mozilla Firefox browser. The last one that I use is the Postman REST Client for the Google Chrome browser. They are all good REST client’s to use, it really boils down to personal choice. In this post we will use the RESTClient add-on for Mozilla Firefox.

Once you are done with enabling either of these plug-ins, you need to know couple of other pieces of information before you send the REST request body to the NSX for vSphere Manager to setup the Syslog for NSX for vSphere Controller.

First of all REST API Requests require Authentication header (REST Client will Base 64 Encode the Credentials for NSX for vSphere Manager. Also PUT or POST (If sending HTTP Body) will require you to set an additional Header. There are as below:

  • Name = Content-Type
  • Value = application/xml

Confirm Authorization & Content-Type headers are properly setup.

REST-Headers

At this point you are all set to go ahead and put the request body to configure Syslog for NSX for vSphere Controllers. Make sure you select the Method as POST. Put the URL as https://<NSX for vSphere Manager>/api/2.0/vdn/controller/{controller-id}/syslog where controller id can be found on the NSX Installation screen.

HTTP Request body has to be this:

<controllerSyslogServer>
<syslogServer>x.x.x.x</syslogServer>
<port>514</port>
<protocol>UDP</protocol>
<level>INFO</level>
</controllerSyslogServer>

x.x.x.x represents your centralized syslog server such as VMware Log Insight. You should get your expected response from it as 200 OK if everything is fine.

REST API - Syslog

If you want to retrieve details about the configured syslog exporter on the specified controller node, you need to send this HTTP request.

Method: GET
Request: https://<nsxmgr-ip>/api/2.0/vdn/controller/{controller-id}/syslog

If you want to delete the syslog exporter on the specified controller node then use this HTTP request.

Method: DELETE
Request: https://<nsxmgr-ip>/api/2.0/vdn/controller/{controller-id}/syslog

 

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 “Configuring Syslog for NSX for vSphere Controller using REST API

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