Log a zone's queries

Turn on query logging for a hosted zone, and read the queries the nameservers answered for it.

Last updated 18 November 2026View as Markdown

Replace zone-id with the id of your hosted zone. With query logging on, every query the nameservers answer for the zone becomes one line in its log, about a minute later, kept seven days:

www.example.com A NOERROR answers=1 udp 203.0.113.0/24 DO

The fields are the name, the type, the response code, the number of answers, the transport, the client's network (a /24, or a /56 for IPv6, never its address), and DO or ECS when the query asked for signatures or carried a client subnet. Each nameserver logs at most 1,250 lines a minute for a zone, fewer when other zones that log their queries share that limit with it; queries past it are counted in the metric (see Monitoring) but not logged.

Prerequisites

  • Permission for dns:UpdateQueryLogging on the zone to turn logging on or off, and dns:GetQueryLog to read the log. In the console, without them, the tab says "Changing query logging needs dns:UpdateQueryLogging on this zone." or "Reading the query log needs dns:GetQueryLog on this zone."
  • In the console, also dns:ListZones to open Hosted zones (without it the page shows an access-denied notice) and dns:GetZone to open the zone (without it the zone's page is not found).

Turn query logging on

  1. Open the zone, then choose the Query log tab.
  2. Under Query logging is off, choose Turn on.

The console says "Query logging is on." Turn off turns it off again.

The nameservers start logging on their next pull.

Read the log

  1. Open the zone, then choose the Query log tab.

Recent queries lists the last hour, at most 200 lines, newest first, with When, Nameserver and Query. Search them with the box above the table. With no lines in that hour it says "No queries logged in the last hour."

Did this page help you?