After my last article “Playing with REST APIs and HTTPie (vCloud API)“ someone contacted me to know more about vCloud Director & vCNS, and especially syslog configuration with multiple tenants.
Here was the question :
What if we (Service Providers) want to setup a different syslog server for each tenant, which are backed behind their respective vShield Edge Gateways ? Actually vCloud Director only allows to configure one common syslog address for *everyone*.
So just to get started with HTTPie, the tool I’ll be using to show how to change that syslog configuration on a per vShield Edge Gateway basis, please take check the last article on how to use HTTPie and also note that what I’ll show is probably not something that is supported by VMware for some obvious synchronization issues between vCloud Director and vShield Manager.
Basically vCloud Director pushes the syslog configuration which is setup in “Administration->System Settings->General” as shown in the screenshot above, to every vShield Edge Gateway device within the setup, which means, the modification I’ll show will need to be persistant in some way, if you are trying to keep it valid after any vShield Edge Gateway modification/resynchronization from vCloud Director
Also note that you will need to put an IP that the vShield Edge Gateway device can reach, seams obvious but just in case :-)
One of the ways to keep this configuration working would be to have notification enabled on vCloud Director, and launch any kind of workflow/script, to push back that configuration on a “modify network” notification and correlate it back to the actual device.
That said, let’s dig into the vCNS API.
I’m not going to depict every step as I did in the previous article, but in every screenshot you will see the HTTPie command line I used. Here is the authentication phase with the initial API discovery answer.
The interesting part is highlighted in a red box, which shows how the API is structured, and we can see a way list the Edges Devices, this will be our next step.
Here is the vShield Edge device I’m focusing on, and as you can see, we found the id of it : edge-1
Now the next step is to get the configuration of the vShield for syslog. (I’ve bypassed some REST requests I used for exploring to get back directly to the interesting part)
Change the headers to “Accept: application/json” as depicted in the below screenshot.
Now that we know the syslog configuration, we are going to modify/alter it to our specific syslog server for this particular vShield Edge device. For that I’m creating a new small xml file named syslog.xml with the following content :
Finally pushing the modified configuration (PUT request) with the content of my newly created XML file.
As you can see the answer is a HTTP Code 204 which means Success but will return no content for the body answer.
Looks good !
You should be able to check the specified syslog server for the new logs.
Hope this helps,