Azure devops pipelines, inspect ftp traffic during release

Is there a way to log detailed ftp traffic from microsoft hosted agent? In my case, when running ui tests in release pipeline, screenshoots are uploaded to ftp server. It worked fine for few weeks unitl yesterday when I started getting following errors:

enter image description here

There was no change on the ftp server side and in c# code used for uploading ftp files. Uploading files still works fine when i run tests locally and this issue happens only when they are run from pipeline, so I thought about comparing network traffic, looking for some clues.

1 answer

  • answered 2020-11-24 02:29 Kevin Lu-MSFT

    Is there a way to log detailed ftp traffic from microsoft hosted agent?

    You could try to use the network tracing to collect the Ftp traffic log.

    You could add the configuration in the config file (e.g. web.config , app.config).

    For example: To collect the FTPWebRequest and FtpWebResponse information, you could use system.net.

    <configuration>
      <system.diagnostics>
        <sources>
          <source name="System.Net" tracemode="protocolonly" maxdatasize="1024">
            <listeners>
              <add name="System.Net"/>
            </listeners>
          </source>
        </sources>
        <switches>
          <add name="System.Net" value="Information"/>
        </switches>
        <sharedListeners>
          <add name="System.Net"
            type="System.Diagnostics.TextWriterTraceListener"
            initializeData="network.log"
          />
        </sharedListeners>
        <trace autoflush="true"/>
      </system.diagnostics>
    </configuration>
    

    Then it will create a network.log file.

    Since you are using the Microsoft-Hosted agent, you could determine the file location and use the Publish Build Artifacts task to upload the file as build artifacts.