I am trying to figure out how to use the await _dockerClient.System.MonitorEventsAsync( api and specify a since parameter.
Multiple variations have been unsuccessful.
await _dockerClient.System.MonitorEventsAsync(
new ContainerEventsParameters()
{
Since ="",
Filters = new Dictionary<string, IDictionary<string, bool>>()
{
{
"type", new Dictionary<string,bool>()
{
{ "service", true }
}
}
}
}, new Progress<Message>(OnHandleServiceEvent), monitorCancelToken.Token);
What version of Docker.DotNet?:
3.125.15
When my application first runs, I'd like to get all the logs since the beginning of time. What should I specify as the since parameter to do this? All my attempts have resulted in a parse error returned from docker.
Then as I progress each log, it has a unix datetime associated with it. I am able to save an anchor locally based on var anchorDateTime = DateTimeOffset.FromUnixTimeSeconds(message.Time); where message is the log message received via the above monitor events async api. if my application terminates, when it next runs, I load the anchor as a datetime. In this instances I want to get the logs greater than the last anchor date. I am aware that the docker api for this allows --since to be passed in various forms like unix timestamps or RFC3339 dates. I think I'd just like to find a successful exampe of this param being used and to understand what is supported so I can try and woork out how to fulfil this use case where I anchor by the message time.
The container log API expects the since and until argument as total seconds starting on the January 1st 1970 at UTC (Unix epoch). We are passing the following to the Docker endpoint 1 and 2. I hope that helps.
I am trying to figure out how to use the
await _dockerClient.System.MonitorEventsAsync(
api and specify asince
parameter. Multiple variations have been unsuccessful.What version of Docker.DotNet?:
When my application first runs, I'd like to get all the logs since the beginning of time. What should I specify as the
since
parameter to do this? All my attempts have resulted in a parse error returned from docker.Then as I progress each log, it has a unix datetime associated with it. I am able to save an anchor locally based on
var anchorDateTime = DateTimeOffset.FromUnixTimeSeconds(message.Time);
wheremessage
is the log message received via the above monitor events async api. if my application terminates, when it next runs, I load the anchor as a datetime. In this instances I want to get the logs greater than the last anchor date. I am aware that the docker api for this allows--since
to be passed in various forms like unix timestamps orRFC3339
dates. I think I'd just like to find a successful exampe of this param being used and to understand what is supported so I can try and woork out how to fulfil this use case where I anchor by the message time.