Lay of the land
Just a quick one today. It is possible to set a syslog server for each NSX controller. This will allow for reporting of events to a syslog server. In my case, I have LogInsight (LI)clustered behind the VIP of 192.168.110.99. This is the IP of the FQDN representing my LI master and three workers. NSX manager is installed and three controllers have been deployed.
Web API access
I am going to use the Mozilla firefox REST API client against the NSX manager. I need to ensure the following
- content-type application/xml
Checking controller settings
Time to check existing settings on the controllers. By issuing the following GET command you will see nothing configured.
GET https://nsxmgr-l-01a/api/2.0/vdn/controller/controller-1/syslog <?xml version="1.0" encoding="UTF-8"?> <error> <details>404 Not Found</details> <errorCode>100</errorCode> </error>
Here we can see nothing is configured for our Syslog servers for the NSX controllers. Where controller-1 is the name of the controller you can substitute the name of other controllers.
Posting our desired settings
Okay. Time to issue a POST against the NSX manager to configure the settings. This will need to be repeated against all controllers.
<controllerSyslogServer> <syslogServer>192.168.110.99</syslogServer> <port>514</port> <protocol>TCP</protocol> <level>INFO</level> </controllerSyslogServer>
Where controller-1 is the name of the controller, substitute for other controllers.
Now what is a change without a validation of the work performed.
Time for an API Validation
Time to issue the command we used earlier to check our change was successful.
<?xml version="1.0" encoding="UTF-8"?> <controllerSyslogServer><syslogServer>192.168.110.99</syslogServer><port>514</port><protocol>TCP</protocol><level>INFO</level></controllerSyslogServer>
There is some XML output stating our change has been committed correctly. Check all controllers to ensure this has been changed.
API all the things
Whilst this was done with a REST API and browser client it would be possible to this with python, powershell, or programming language of choice. The key thing here is a rather clicky clicky UI change can be done very simply and efficiently. ALL HAIL API.