Docker Cloud: Monitoring and Logging
Docker Cloud: Monitoring and Logging
In 10-15 minutes you could be looking at charts with all your Docker operations data in one place, accessible by your whole team! Read on to see how it's done by wielding Docker Cloud.
Join the DZone community and get the full member experience.Join For Free
See why enterprise app developers love Cloud Foundry. Download the 2018 User Survey for a snapshot of Cloud Foundry users’ deployments and productivity.
Docker Cloud is a hosted service for Docker Container Management, originally based on Tutum Cloud, which was acquired by Docker in October 2015. Sematext supported the deployment of Sematext Docker Agent on Tutum Cloud from the get-go, so naturally we were quick to add support for Docker Cloud as well.
What is Docker Cloud?
Docker Cloud is a container management service that supports multiple cloud providers such as Amazon, DigitalOcean, IBM Softlayer, MS Azure, and Packet.net. This makes it much easier to switch Docker deployments to different cloud providers or use a mix of providers including on-premises nodes for hybrid cloud applications. The user interface in Docker Cloud makes it easy to manage nodes on all supported cloud platforms and is able to deploy application stacks in containers, defined in a "Stack YAML" file. These Stack files are very similar to Docker Compose files, but with additional options, e.g. to define deployment strategies for the containers. The graphical user interface helps to view and modify container configurations.
Docker Cloud Metrics & Logs
Once containers are deployed you can get a very basic real-time log stream view per container (see below). This is helpful for a quick glance at the most recent logs of a specific container.
There are currently no Docker metrics exposed anywhere in Docker Cloud, though that will surely be added with time. Docker Cloud does an excellent job for the "Build, Ship, and Run" containers paradigm. But, if you’ve ever built a production system you know there is more to it. There is this little wrinkle called Operations. So, let’s talk about the more realistic scenario – "Build, Ship, Run and Monitor".
Thanks to the Docker API, it is possible to add this functionality to Docker Cloud. Sematext Docker Agent is a small container that collects all Docker metrics, all app and Docker logs, and all Docker events from Docker Cloud and together with SPM for Performance Monitoring and Logsene for Log Management and Analytics it provides advanced Performance Monitoring and Log Management functionality for stacks deployed in Docker Cloud:
- Detailed Metrics with a long retention time. Having detailed metrics helps optimize resource usage of applications. Detailed metrics let you set application-specific alerts for any critical resources your applications depends on. Metrics are aggregated for all hosts, images, and containers and filterable by hosts, images, and containers. This lets you drill down from a cluster view down to a single container while troubleshooting or simply understand operations details. Long retention times for metrics make it possible to compare resources before and after different deployments and releases or troubleshoot problems that appear only when a service has been running over several days or weeks!
- Full-text search, filtering, and analytics across all containers. Logs are collected, parsed, and shipped by Sematext Docker Agent. The integrated charting functions in Logsene and integrations for Kibana and Grafana make it easy to analyze logs collected in Docker Cloud. In short, you can use Logsene as a "super grep" for your Docker and application logs, but also as a much more affordable Splunk or any other BI tool, or a managed Elastic stack (aka ELK).
- Long retention time for logs, metrics, and events. Comparing metrics and logs during deployments or watching the performance under different workloads requires one to store logs and metrics for a reasonable time. We have seen cases where memory leaks started to get serious after a few weeks of stable operations, although initially they were not detected. In such a case all context information like logs, events, and metrics could be very valuable in identifying the root cause of such problems.
- Tracking of all Docker Events. Tracking of all Docker Events gives you a clear view of your containers’ life cycle. For example, by collecting Events you gain insight into what happens with your containers during (re)deployments or the re-scheduling of containers to different nodes. Some containers might be configured for automatic restarts and the events could indicate if container processes crash frequently. In case of out-of-memory events, it might be wise to modify the memory limits or check with the developers, why this event happened.
- Anomaly detection and alerts for all logs and metrics. Who wants to watch metrics and logs all day long? Not me! Let the monitoring system watch outliers for metrics or query your logs! Anomaly detection can help reduce the noise and alert fatigue often caused by classic threshold-based alerts. Even log-alerting is possible with Logsene e.g. to detect anomalies in the log frequency of a specific query. For example, a search for "error" in the system might normally return a dozen non-critical errors, which could be ignored. A growth in the log frequency of error messages indicates that something might be going wrong. Another type of alerts is the Heartbeat alert for all cluster nodes. Disk Space alerts are very useful for Docker nodes, because Docker images might consume a lot of disk space. Docker Cloud runs some cleanup agents to remove unused containers and images; nevertheless, the default disk-space alert created by SPM gives you an early warning before the capacity limit is reached.
Here’s a short video about Log Management and Monitoring for Docker. It gives a general overview of Monitoring and Log Management in Docker context, plus shows you how to use SPM and Logsene as a single pane of glass for your Docker metrics and logs.
Having all these operational insights and having it located in a single pane of glass makes everyone’s work (and that means life, too) simpler. We all want that, no? With that in mind, we’ve made sure the Sematext Docker Agent setup is super quick and easy:
- Get a free account at apps.sematext.com, if you don’t have one already
- Create an SPM App of type "Docker" to obtain the SPM Application Token and/or Create a Logsene App to obtain the Logsene Application Token
- Click the "Deploy to Cloud" button in Sematext UI and copy the generated token into the Stackfile text field in Docker Cloud
- As soon you click "Create and deploy" in Docker Cloud, the Sematext Docker Agent will be pulled from Docker Hub and it will start on all nodes managed by Docker Cloud. A few seconds later you should see Events, Logs, & Metrics in SPM & Logsene.
Everything mentioned above could take you just 10-15 minutes, meaning that in 10-15 you could be looking at charts with all your Docker operations data in one place, accessible by your whole team!
If you have feedback for monitoring and logging on Docker Cloud get in touch with us via @sematext or email us at email@example.com—we love to talk about monitoring and logging and appreciate user feedback that helps us improve our services and make them better serve your needs. If you want to try SPM or Logsene, start here.
Published at DZone with permission of Stefan Thies , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.