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 Cloud de Confiance 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, complete the following steps.

Console

  1. In the Cloud de Confiance console, go to the Create a DNS policy page.

    Go to Create a DNS policy

  2. For Name, enter a name for your policy.

  3. Optionally, enter a description for Description.

  4. For Logs, select On.

  5. In the Networks section, click Add networks and choose the networks you need.

  6. Click Create.

gcloud

Run the dns policies create command.

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, complete the following steps.

Console

  1. In the Cloud de Confiance console, go to the Cloud DNS policies page.

    Go to Cloud DNS policies

  2. Click the DNS server policy you want to update.

  3. Click Edit policy

  4. In the Logs section, select On.

  5. Click Save.

gcloud

Run the dns policies update command.

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, complete the following steps.

Console

  1. In the Cloud de Confiance console, go to the Cloud DNS policies page.

    Go to Cloud DNS policies

  2. Click the DNS server policy you want to update.

  3. Click Edit policy

  4. In the Logs section, select Off.

  5. Click Save.

gcloud

Run the dns policies update command.

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