Collect Amazon DocumentDB Metrics and Logs With Datadog | Datadog

Collect Amazon DocumentDB metrics and logs with Datadog

Author Daniel Langer

Published: March 14, 2019

Amazon DocumentDB is an AWS-managed document database service that boasts compatibility with the MongoDB 3.6 API. As a managed service, AWS automatically handles database management tasks, autoscales database clusters, and backs up your data to S3.

Whether you are migrating existing workloads or building new applications, Datadog’s Amazon DocumentDB integration provides visibility into key metrics and logs from your database clusters. By monitoring DocumentDB, you can ensure that your clusters are properly provisioned, read and write times are meeting your SLOs, and your costs are in line with expectations.

Datadog's Amazon DocumentDB dashboard
Datadog's out-of-the-box Amazon DocumentDB dashboard.

How Amazon DocumentDB works

A DocumentDB cluster consists of two primary components: one or more EC2 instances, which provide an isolated database environment that can contain one or more databases, and a cluster storage volume that manages data for all of the instances. The storage volume automatically replicates your data across three availability zones, even if you do not have instances in those zones.

When you launch a cluster, you select the instance class and the number of instances that cluster should contain. The instance class determines the computation and memory capacity of the instance, and you should choose a class depending on your application’s requirements.

Amazon DocumentDB instances only run in Amazon VPC environments, and the service offers a suite of other security features. Additionally, you can create instances across availability zones to protect against instance failure.

Key Amazon DocumentDB metrics

Datadog’s Amazon DocumentDB integration automatically pulls in metrics from your instances and clusters so you can monitor the health and performance of your entire database infrastructure in one place. A full list of the metrics we collect can be found in our detailed Amazon DocumentDB documentation.

Because each instance type has different resource capacities under the hood, tracking resource metrics such as CPU utilization, available memory, network throughput, and volume I/O and latency provide insight into whether your cluster is properly scaled and using the instance class best suited to your use case. For example, the DiskQueueDepth metric tracks the number of outstanding read/write requests waiting to access the disk. If this value starts to grow, it may make sense to rethink your instance class.

Volume usage and throughput can affect DocumentDB pricing. Metrics like VolumeWriteIOPs and VolumeReadIOPs track total number of operations for each cluster volume, helping monitor the cost of your clusters. Additionally, VolumeBytesUsed tells you the amount of storage used per cluster. Finally, you can calculate backup storage costs by using the BackupRetentionPeriodStorageUsed and TotalBackupStorageBilled metrics.

DocumentDB audit logging in Datadog

In addition to metrics, Amazon DocumentDB can log cluster events into CloudWatch Logs for auditing. These events include things like cluster authentication attempts, database create and deletion, and collection creation and deletion. Detailed information on the full list of audit events and how to enable log auditing for your clusters can be found in Amazon’s DocumentDB documentation.

Once auditing has been enabled for your clusters, you can use Datadog’s AWS logging integration to send these logs from CloudWatch Logs to Datadog automatically.

Datadog’s DocumentDB logs integration will automatically parse out the audit logs into human-readable format and enable you to search and filter on important attributes such as event type (eventName), user, and more.

Datadog's Amazon DocumentDB audit log parsing

Start monitoring your Amazon DocumentDB clusters with Datadog

Datadog’s Amazon DocumentDB integration lets you easily monitor and alert on your cluster and instance metrics. If you’re already monitoring other AWS services with Datadog’s main AWS integration, simply make sure that “DocumentDB” is selected in the AWS integration tile to start collecting metrics from Amazon DocumentDB along with the rest of your AWS infrastructure. If you don’t already have a Datadog account, sign up for a free .