Thursday, January 22, 2015

Docker/Fig tip: easily watch cluster logs

When using Fig to run a cluster of Docker containers, it's handy to have a console, and also a separate terminal with information so you can see what's going on.  That is, an interactive console, plus all the logs from all the containers.

Use Fig to start your cluster, then interactively your containers as needed. As you modify stuff, the services emit logging messages, which you can see in the second terminal.

here's the code for the second terminal. It uses Fig to get logs for all the containers.  When the config is changes and the cluster is restarted, this command loops again to reconnect and get all the new log messages. In this way you can just do you work and this terminal will always have the latest logs.

Watch Docker cluster logs, even after restart

for ((;;)) ; do fig logs ; done

tl;dr: infinite loops ftw

No comments:

Post a Comment