Recording DNS Activity with Resolver Query Logging
This lesson explains how Route 53 Resolver query logging records every DNS query made from associated VPCs, making DNS activity searchable evidence across the organisation during incidents.
Learning outcomes
After completing this lesson, you will be able to:
- Describe what a query log record contains.
- Choose a destination for query logs.
- Explain how query logging is centralised across accounts.
What is logged
Each log record includes the query name and type, the response code and answers, the source VPC, the source IP address and instance ID, and any DNS Firewall rule and action applied. Queries resolved through private hosted zones, Resolver rules and the public DNS are all included, whether they originate from instances, containers or Lambda functions in the VPC.
Destinations
Resolver query logs record the DNS queries made from VPCs, and the destination depends on how they will be used. CloudWatch Logs suits searching recent queries with Logs Insights and alerting with metric filters and alarms, for example on lookups of a suspicious domain. Amazon S3 suits low-cost, long-term retention and analysis with Athena, for investigations months later. Amazon Data Firehose suits streaming the logs to a SIEM, OpenSearch or a third-party destination. The following table summarises the destinations.
| Destination | Suited to |
|---|---|
| CloudWatch Logs | Searching recent queries with Logs Insights, metric filters and alarms |
| Amazon S3 | Low-cost long-term retention and analysis with Athena |
| Amazon Data Firehose | Streaming to a SIEM, OpenSearch or a third-party destination |
Centralizing across accounts
A query logging configuration names a destination and is associated with VPCs. To log every VPC in an organisation in one place, the security or networking account creates a configuration that delivers to a central destination and shares it through AWS RAM; workload accounts then associate their VPCs with the shared configuration, usually through a baseline template applied to every new VPC.
Amazon Security Lake can collect Resolver query logs from every account and normalise them to the Open Cybersecurity Schema Framework (OCSF) alongside CloudTrail and flow logs, which suits organisations feeding a SIEM. Separately, GuardDuty analyses DNS activity for threats using its own independent stream, so threat detection does not depend on query logging being enabled; query logging provides the searchable record that investigators use.
GuardDuty reports that an instance contacted a known malicious domain. The security team must find every other instance in the organisation that resolved the same domain in the last 90 days.
With query logging shared through RAM to every VPC and delivered to S3 in the log archive account, an Athena query on the domain name returns every source instance and VPC, with timestamps. Without query logging, the team would have only the single GuardDuty finding.
Where can Resolver query logs be delivered?
Show answer
To CloudWatch Logs, Amazon S3 or Amazon Data Firehose.
Exam Tips
Remember for the exam
- Query logging identifies which resource made a lookup.
- Share query logging configurations through RAM to log every VPC centrally.
- Deliver to S3 for retention and Athena queries, or to CloudWatch Logs for alarms.
- Security Lake can collect Resolver query logs in OCSF format.
- GuardDuty analyses DNS activity for threats independently of query logging.