Use logging and monitoring

This page provides information about logging and monitoring metrics for Cloud DNS including private zones and forwarding zones.

Use Cloud DNS logging

Cloud DNS logging tracks queries that name servers resolve for your Virtual Private Cloud (VPC) networks.

Logged queries can come from Compute Engine virtual machine (VM) instances, Google Kubernetes Engine containers in the same VPC network, peering zones, or on-premises clients that use inbound DNS forwarding. Private DNS zones, forwarding DNS zones, alternative name servers, internal Trusted Cloud DNS zones, or external DNS zones might eventually resolve the queries.

Log records belong to the project that owns the network that carried the request. In the case of Shared VPC, the log records belong to the host project because the host project owns the network.

Enable and disable logging for private managed zones

Use DNS policies to enable or disable logging for your networks. When you enable query logging, every DNS query to a Cloud DNS private managed zone is logged.

To enable logging for a network that does not have a DNS policy, run the dns policies create command.

gcloud

gcloud dns policies create POLICY_NAME \
    --networks=NETWORK \
    --enable-logging \
    --description=DESCRIPTION

Replace the following:

  • POLICY_NAME: the name of the DNS policy
  • NETWORK: one or more networks in a comma-separated list
  • DESCRIPTION: a description of the policy

To enable logging for a network that has an existing DNS policy, run the dns policies update command.

gcloud

gcloud dns policies update POLICY_NAME \
    --networks=NETWORK \
    --enable-logging

Replace the following:

  • POLICY_NAME: the name of the DNS policy
  • NETWORK: one or more networks in a comma-separated list

To turn off logging while leaving the policy in place, run the dns policies update command.

gcloud

gcloud dns policies update POLICY_NAME \
    --networks=NETWORK \
    --no-enable-logging

Replace the following:

  • POLICY_NAME: the name of the DNS policy
  • NETWORK: one or more networks in a comma-separated list

To delete the policy entirely, run the dns policies delete command.

gcloud

gcloud dns policies delete POLICY_NAME \

Replace POLICY_NAME with the name of the DNS policy that you want to delete.