GCP DNS query logging not working - gcloud dns managed-zones update zonename --log-dns-queries

Viewed 174

On https://cloud.google.com/dns/docs/monitoring documentation page there is a command to enable GCP DNS query logging that does not work:

gcloud dns managed-zones update zonename --log-dns-queries

When command from documentation is issued following error message is displayed:

ERROR: (gcloud.dns.managed-zones.update) unrecognized arguments: --enable-logging

Is it possible on GCP to turn on logging for an existing public managed zone using the dns managed-zones update command?

1 Answers

The argument that you are using does not exist (--log-dns-queries).

To enable Google Cloud DNS logging, create a policy

gcloud dns policies create mypolicy \
--description='My Policy' \
--networks=network1 
--enable-logging

Cloud DNS logging tracks queries that name servers resolve for your Virtual Private Cloud (VPC) networks, as well as queries from an external entity directly to a public zone.

I reviewed the documentation that shows the command that you are using. I am not sure, but first create a policy and then try the command. I think that is why the error message specifies a different argument. However, creating the policy does enable logging, so that is actually redundant.

Related