if i create a container with fig and let it run and produce lots and lots of logs, when i execute:
fig logs
for the first time it can take minutes to print all the logs (this is because I am running some development application in debug mode). I would like to have a feature like with tail, where I can specify the initial amount of lines say for example:
fig logs -n 1000
which would print the last 1000 lines of the logs it could be either the last for each container or the total 1000, as long i can avoid the initial print of thousands of logs... that I am not interested in...
AFAIK this is something that's needed upstream in Docker.
ok then!
@bfirsh
docker now support limit logs
docker logs --help
Usage: docker logs CONTAINER
Fetch the logs of a container
-f, --follow=false Follow log output
-t, --timestamps=false Show timestamps
--tail="all" Output the specified number of lines at the end of logs (defaults to all logs)
Great! We need an implementation of --tail
for fig logs
then.
:+1: +1 yeah
Please?
Bump :)
:+1:
There currently work in progress upstream in Docker to add support for limiting logs; https://github.com/docker/docker/pull/11485
+1 Really need it
+1
+1
FWIW: +1
+1
docker-compose rm
docker-compose up
that's will do the trick for you, guys
This would involve using the logs endpoint in docker-compose logs
, as opposed to the attach endpoint, but I think that's fine.
It would also only work for containers using the json-file
logging driver, according to the API docs.
@twistsm docker-compose rm && docker-compose up
drops volumes (including volumes for data containers), limiting the utility of this workaround :(
:+1: for this.
It can solved easy with a bash script like this
docker-compose ps | \
awk '{print $1}' | \
grep APPNAME!! | \
xargs -I{} docker logs --tail=10 -f {}
+1 for this
+1
+1
+1
+1
+1
+1
+1
This issue makes docker-compose logs
useless if you have to wait through 30 minutes of old logs to see what's actually going wrong. Is there a way to clear the logs daemon (or however it is implemented)? Without having to stop all services, rm and the up...
Suggestion:
if -f
is specified, automatically default to the last 10 lines.
Follows the usage of the tail
command.
if i wanted to just tail from end of the log, is it this?
docker-compose logs -f --tail=1
Most helpful comment
Suggestion:
if
-f
is specified, automatically default to the last 10 lines.Follows the usage of the
tail
command.