If you use the Coreutils tail command in Linux, you have a -f option that lets you follow a log file from the log's current position (it does not go to the very beginning of the file and display everything).
Is this functionality available in docker logs without waiting for it to traverse the whole log?
I have tried:
docker logs --since 1m somecontainer
and
docker logs -f --since 1m somecontainer
It appears that it actually traverses the entire log file (which can take a long time) and then starts echoing to the screen once it reaches the time frame you specify.
Is there a way to start tailing from the current point without waiting? Is my best option to always log out to some external file and tail that with the Coreutils tail command?
Alternatively, we can check the log by time (eg. since last 2mins) as:
docker logs --since=2m <container_id> // since last 2 minutes
docker logs --since=1h <container_id> // since last 1 hour
use the --tail switch:
> docker logs -f <container name> --tail 10
this will show the log starting from the last 10 lines onwards