Recently I deployed syslog server in my vCloud Lab and was looking for a way to send Edge gateway logs to my syslog server. This post in focused on how to configure edge gateway syslog settings.
VMware vCloud® Air supports the ability for customers to collect information about traffic coming to and from their edge gateway through the use of a syslog server. By configuring edge gateway to transfer log data to your syslog server, you can then set up alerts or notifications and build reports with your preferred tools.
If you do not have ANS subscription in vCloud Air then the only way to configure syslog settings on the Edge gateway is via vCloud API. There is no option available in GUI when you open edge gateway properties from within vCloud Director interface.
When it comes to using Rest API we have variety of choice to use as Rest Client. Some of the common clients include curl, Postman,Mozilla rest Client etc.
I personally prefers curl and postman and in this post I will demonstrate the curl option.
Requirements to Configure Syslog on Edge Gateway:
1: A REST client.
2: vCloud Air credentials.
3: vCloud Air Endpoint/Org name.
4: Configured syslog server and IP address.
Obtaining vCloud Air Endpoint/Org name
You can obtain the endpoint details by logging into vCloud Air portal and navigating to your Org/vDC.
Obtaining vCloud Air supported API versions
List of supported API versions that can be used with vCloud Air can be obtained by firing below command.
# curl -sik -H “Accept:application/*+xml;version=5.6” -u “firstname.lastname@example.org” -X GET https://au-south-1-15.vchs.vmware.com/api/versions
You will get a long list of versions as output. Select any one of the version. Also make a note of the login URL.
Obtaining Auth Code for vCloud API Login
You need 4 things for generating Auth code for API login
A: Login URL (copy from previous output)
B: API Version: (copy from previous output)
C: Customer Header: Accept:application/*+xml;version=9.0
D: vCloud Air Credentials in format: username@domain-name@org-name
When you have all the 4 info handy, fire below API query to obtain Auth code
# curl -sik -H “Accept:application/*+xml;version=9.0” -u “email@example.com@bdd75fd4-a319-47d5-b4f2-77aad691488f” -X GET https://au-south-1-15.vchs.vmware.com/api/compute/api/sessions | grep auth
Enter host password for user ‘firstname.lastname@example.org@bdd75fd4-a319-47d5-b4f2-77aad691488f’:
Now use following API queries in sequence
Find Org Href
# curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization:1e95dc1064aa4083ae79bb617221853e” -X GET https://au-south-1-15.vchs.vmware.com/api/org/ | grep bdd75fd4-a319-47d5-b4f2-77aad691488f
Note: bdd75fd4-a319-47d5-b4f2-77aad691488f is my org name
<Org href="https://au-south-1-15.vchs.vmware.com/api/compute/api/org/4f5feba5-bb82-456e-8898-95d4970f2624" name="bdd75fd4-a319-47d5-b4f2-77aad691488f" >
Find vDC Href
# curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization:1e95dc1064aa4083ae79bb617221853e” -X GET https://au-south-1-15.vchs.vmware.com/api/compute/api/org/4f5feba5-bb82-456e-8898-95d4970f2624 | grep vdc
<href="https://au-south-1-15.vchs.vmware.com/api/compute/api/vdc/e89232de-3507-4b66-98d7-8ec25e99c826" name="Manish-VCAP-LAB" >
Find Edge Gateway Href
# curl -sik -H “Accept:application/*+xml;version=5.6” -H “x-vcloud-authorization:1e95dc1064aa4083ae79bb617221853e” -X GET https://au-south-1-15.vchs.vmware.com/api/compute/api/vdc/e89232de-3507-4b66-98d7-8ec25e99c826 | grep edge