[Bug / Feature request] Dockers api for container log download only accepts unix timestamps (int) for the 'since' parameter #41784
Labels
area/api
kind/enhancement
Enhancements are not bugs or new features but can improve usability or performance.
Description
Dockers container log download command has the option to specify from which timestamp beginning, it should show the logs, which supports unix timestamps with milliseconds, but the docker api only supports unix timestamps without milliseconds.
Explanation
An example line from docker logs --timestamps looks like this
2020-12-12T22:06:40.055209477Z [22:06:40 INFO]: Timings Reset. The timestamp in the beginning also displays microseconds (055209477).
Dockers command docker container logs --since supports unix timestamps with microseconds.
The docker engine on the other hand only supports unix timestamps without microseconds, as it only accepts an integer value, which can't store milliseconds or even microseconds. (https://docs.docker.com/engine/api/v1.41/#operation/ContainerLogs)
This results in sometimes inaccurate results.
Problems
You can't precisely download logs beginning from a certain timestamp through the api, because you cant send milliseconds to the docker api, which you would need to get correct results.
How to reproduce the problem
Start a container and execute docker logs --timestamps and convert the timestamp of the last log line to unix time (while doing so you will lose information about the microseconds of the log)
Then download the logs of that container using the api and set the 'since' parameter to the previously converted unix timestamp.
The first few lines will container log messages, which you have already gotten from the first docker logs command.
The text was updated successfully, but these errors were encountered: