Getting transfer rates via API or command line

I can see the transfer rates, time (percentage etc) taken to transfer etc on the web GUI. Is there any way to get this information via API or write to a log file? I need to test the transfer rates that can be achieved.

With the REST API endpoint rest/system/connections you get a total.inBytesTotal and total.outBytesTotal. Using that and the time between your requests (or better the difference in total.at) you can get the transfer rate.

The same data is available for each device, if you want to track each devices speed individually.


The WebUI does the same thing:

For testing, there is also a developer-centric performance logging feature. If you start Syncthing after setting the environment variable STPERFSTATS=1 it’ll write a log file perfstats-$pid.csv. It’ll look something like:

250     0.000000        900200  8755448 0       0
503     92.347892       10423360        17938680        0       0
750     13.269266       11515576        20101368        0       0
1000    11.311525       13090016        22268152        0       0
...

where the columns are

  1. milliseconds since startup
  2. cpu usage in percent
  3. allocated bytes
  4. in use bytes
  5. in data rate (bytes/s)
  6. out data rate

Not supported on Windows or Solaris unfortunately. The API described above is supported everywhere.

1 Like

Thanks a lot! I will definitely try this!

1 Like