Viewing Container Logs thru Docker UCP

UCP Dashboard

The Docker Universal Control Plane provides a wealth of information about the Docker cluster. There is information for both Swarm and Kubernetes. There are tons of detailed information about stacks, services, containers, networks, volumes, pods, namespaces, service accounts, controllers, load balancers, pods, configurations, storage, etc. (I think you get the point).

UCP Dashboard

UCP’s dashboard page provides global metrics on CPU, Memory, and Disk Usage across the cluster and broken down by manager and worker nodes. If you drill down to the container level you can view these same metrics on a per replica basis.

For an administrator, you can manage the Users, Roles, Organizations and Teams and apply the roles to implement the desired RBAC scheme.

Of course all of this is available from the command line via the docker CLI. However, for those who like a good web user interface, then UCP is the way to go.

Container Logging

From a developers perspective however, one of the most useful things you can do is to look at your container logs. A developer needs to know what is going on with the application. Is there an error? Are there any warnings? Can I trace down where a particle issue resides?

UCP view logs

To view the container’s application logs, all you have to do is drill down from your service to your container and then click on the “View Logs” button. It’s that simple.

UCP logs

The Problem

This is good, because now I can see my logs scrolling by. The problematic part is that I’m stuck with something around 80 characters wide. All that wasted space on the left and right. I can adjust the height of this window, but I cannot adjust the width. This very frustrating “problem” has been around for over a year and a half.

The Work Around

Since you must be a developer if you have read this far into the blog, then you can handle the work-around. Open your browsers Developer Tools window.

$('.styles__logWrapper___12lGG').style['max-width'] = '100%';
$('.dreadonlyTerminal').style['max-width'] = '100%';
$('.dreadonlyTerminal').style['height'] = '780px';

Lucas, a colleague of mine, provided me this script which really gets at the heart of the work around. Copy and Paste this script into your Developer Tools Console panel.

UCP logs wide

Once you have adjusted the width, you can safely close the Developer Tools panel. As long as your browser window stays open, you will have the wide screen logging output.

Conclusion

Hopefully this little tid-bit of information enhances the viewing of your logs thru the UCP Web interface. If you have any questions, insights, or comments feel free to Leave a Comment on this blog or you can contact us at Capstone.

Mark Miller
Docker Accredited Consultant
Solutions Architect at Capstone