3 Replies Latest reply on Jan 31, 2019 9:00 AM by sk84

    Downloading Edge tech support logs using API

    NOCUKCloud Lurker

      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. Re: Downloading Edge tech support logs using API
          sk84 Expert
          vExpert

          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

          • 2. Re: Downloading Edge tech support logs using API
            NOCUKCloud Lurker

            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?

            • 3. Re: Downloading Edge tech support logs using API
              sk84 Expert
              vExpert

              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.