How to read docker events by API (until/since/filter parameters)

I can read docker events with bask like this

   sudo  docker events --until '24h'

However I don’t understand parameters since and until in this document Docker Engine API v1.41 Reference

any my attempt prepare correct value to since and until parameters failed

  {"message":"strconv.ParseInt: parsing \"24h\": invalid syntax"}

what correct format of since and until?

Without this parameters maybe output stream is too long, after about 10 seconds I receive this error (.NET Core)

 An exception occurred during a WebClient request.
 at System.Net.WebClient.DownloadBits(WebRequest request, Stream writeStream)
 at System.Net.WebClient.DownloadDataInternal(Uri address, WebRequest& request)
 at System.Net.WebClient.DownloadString(Uri address)
 at System.Net.WebClient.DownloadString(String address)

The parameter requires a Unix timestamp (=seconds since 1.1.1970 0:00:00) and not a relative time + unit.

Google consulting says, something like DateTimeOffset.UtcNow.ToUnixTimeSeconds() should convert the UTC DateTime to a unix timestamp.

1 Like