VMware Networking Community
NOCUKCloud
Contributor
Contributor
Jump to solution

Downloading Edge tech support logs using API

Hi,

I'm using powershell to try and collect the techsupport logs for edges by running this:

Invoke-WebRequest -Uri "https://<nsxmanagerIP>/api/4.0/edges/<edge-id>/techsupportlogs" -Method Get -Headers $Headers -ContentType "application/xml"

This command works but I can't seem to get anything useful out of what is returned. If I output this to a file, it is not a log file. If i dive into the content of the returned XML, it looks like a compressed file to me -  which is what I would expect. However, if I try to output this content into a .gz file, every archive tool i've tried says that it is corrupted. I'm at a loss!

1 Solution

Accepted Solutions
NOCUKCloud
Contributor
Contributor
Jump to solution

for anyone who comes across this thread, this works:

Invoke-WebRequest -Uri "https://X.X.X.X/api/4.0/edges/edge-X/techsupportlogs" -Method Get -Headers $Headers -ContentType "application/xml" -OutFile "C:\Users\XXXXXX\Desktop\EdgeLogs.tar.gz"

View solution in original post

Reply
0 Kudos
4 Replies
sk84
Expert
Expert
Jump to solution

Have you read the API documentation?

https://docs.vmware.com/en/VMware-NSX-Data-Center-for-vSphere/6.3/nsx_63_api.pdf (page 282)

With the GET request, you only request the creation of support bundles. The response to this GET request will return a location field in the header with an URL from which you can easily download the compressed support package.

So you need 2 GET Requests. The first to create the support bundle. Then you evaluate the location field in the response header and make another GET request to this location to download the file.

However, there are KB articles for the NSX Controller support bundles that these sometimes take longer to create and the browser runs into a timeout. Maybe this also causes problems when creating Edge Support Bundles. But I don't know.

VMware Knowledge Base

--- Regards, Sebastian VCP6.5-DCV // VCP7-CMA // vSAN 2017 Specialist Please mark this answer as 'helpful' or 'correct' if you think your question has been answered correctly.
NOCUKCloud
Contributor
Contributor
Jump to solution

Hi,

Thanks for the response, that at least clarifies what I thought could be the case. However, I've tried to navigate to the location given in the baseresponse in browser and also tried a GET request against this URL, but always receive "the requested resource is not available" - it doesn't matter how long I wait after making the initial request, any ideas?

Reply
0 Kudos
sk84
Expert
Expert
Jump to solution

If I follow the example in the API documents, it works with "curl":

curl -k -L -s -H 'Authorization: Basic XXXXXXXXXXXXXXXXXXXXXXX' -H "Content-Type: application/xml" -H "Accept: application/xml" -X GET https://10.5.5.15/api/4.0/edges/edge-19/techsupportlogs > NSX_Edge_Support_edge-19.log.gz

And after that:

gunzip NSX_Edge_Support_edge-19.log.gz

This is successful.

But all other attempts with a manual download failed. Here I cannot unpack the received data either, because a "not in gzip format" error occurs.

I'm sorry. Unfortunately I can't help you at this point.

--- Regards, Sebastian VCP6.5-DCV // VCP7-CMA // vSAN 2017 Specialist Please mark this answer as 'helpful' or 'correct' if you think your question has been answered correctly.
Reply
0 Kudos
NOCUKCloud
Contributor
Contributor
Jump to solution

for anyone who comes across this thread, this works:

Invoke-WebRequest -Uri "https://X.X.X.X/api/4.0/edges/edge-X/techsupportlogs" -Method Get -Headers $Headers -ContentType "application/xml" -OutFile "C:\Users\XXXXXX\Desktop\EdgeLogs.tar.gz"

Reply
0 Kudos