Domain Name System (DNS) Logging is the collection and retention of DNS query and response records. It captures which names were looked up, from where and with what result, giving security teams visibility into name resolution for troubleshooting, threat hunting and detecting suspicious domains or beaconing activity.
What DNS logging captures
DNS logging records the questions clients ask the resolver and the answers they receive. That makes it more than an operations record, because DNS is often the first layer where a security team can see a host trying to reach a new domain, follow a redirect chain, or repeatedly query the same name as part of beaconing or other automated activity.
At a practical level, DNS logs usually become useful when they include enough context to connect a lookup to a client, a time, a response code, and a resolver path. Without that context, the record tells you that a name was queried, but not enough about whether the event was routine traffic, troubleshooting noise, or a sign of compromise.
Why DNS logs matter for security visibility
DNS is one of the few control points that touches almost every internet-bound workload, so logging it gives defenders a broad view of name resolution behaviour. That visibility helps identify suspicious infrastructure, discover shadow IT, and spot patterns such as repeated NXDOMAIN responses, fast-flux style movement, or lookups for domains that have never appeared in normal business traffic.
For hunting and incident response, DNS logs are valuable because they often preserve evidence even when later stages of an attack are encrypted or proxied. A malicious callback may be hidden inside HTTPS or another transport, but the domain lookup that preceded it can still reveal intent, staging, or command-and-control infrastructure.
Good DNS visibility also supports the defensive work described in the DNS Security Guide, where logging sits alongside protective DNS, sinkholing, DNSSEC and other controls that shape what can be observed and blocked.
What makes DNS logs useful in investigations
The most useful DNS telemetry is not just a raw query list, but a record of who asked, what was asked, what answer was returned, and whether the response was unusual. That lets analysts pivot from one suspicious domain to the client that contacted it, the time window, the resolver that answered it, and the broader campaign pattern across the environment.
DNS logs are especially helpful when paired with endpoint, proxy, or firewall telemetry. A lookup alone does not prove maliciousness, but the combination can show whether a domain was resolved and then connected to, whether the name was part of a legitimate application flow, or whether the pattern matches automated beaconing, tunnelling, or domain generation activity.
For teams building a logging baseline, the NIST SP 800-81 Rev. 3 Secure DNS Deployment Guide is a practical reference because it connects secure DNS deployment with logging, evidence handling and enterprise controls. At the retention layer, the OMB M-21-31 Logging Maturity Guide is useful when DNS logs need to fit into a broader retention and audit strategy.
Common logging gaps and implementation choices
DNS logging fails when teams log too little, keep it for too short a period, or collect it from only one part of the environment. Resolver logs alone may miss traffic that bypasses the corporate resolver, while endpoint logs alone may not preserve the complete query and response picture. Encrypted DNS adds another challenge, because it can reduce what network tools see unless the organisation has a deliberate visibility strategy.
Teams also need to decide whether they are logging at the recursive resolver, the authoritative server, the endpoint, or all three. Each source answers a different question. Resolver logs are best for enterprise visibility, authoritative logs help understand zone activity, and endpoint telemetry can reveal direct-to-internet DNS behaviour that never reaches managed infrastructure.
Because DNS is a high-volume protocol, selective field retention matters. A useful log usually includes the queried name, source identity, timestamp, response status, resolver, and whether the response was an answer, referral or failure. The point is not to collect everything indiscriminately, but to retain enough context to make the data defensible for troubleshooting and detection.
Threats and analytics that DNS logging helps surface
DNS logs are one of the best early-warning sources for adversary behaviour that depends on domain infrastructure. They can expose beaconing, DGA-style domain lookups, tunnelling attempts, and the use of newly registered or low-reputation domains. They can also show whether a host is trying to reach a domain that should never exist in a normal production workflow.
Analysts often combine DNS logging with domain reputation, sinkhole data and response pattern analysis to separate ordinary browsing from suspicious automation. The logging data does not replace deeper investigation, but it gives the first reproducible clue about what a system tried to resolve before the rest of the attack path unfolded.
Where teams need a more detection-focused treatment of this telemetry, DNS Logging and Detection Guide is the most direct companion resource because it covers collection points, field selection and practical detection logic for DNS-based threats.
Standards & Framework Alignment
This section maps relevant standards and security frameworks to the operational risks and controls described in this guidance.
MITRE ATT&CK addresses the attack and risk surface, while CIS Controls v8, NIST SP 800-53 Rev 5 and NIST CSF 2.0 set the governance and control requirements practitioners need to meet.
| Framework | Control / Reference | Relevance |
|---|---|---|
| CIS Controls v8 | CIS-8 — Audit Log Management | DNS logging is an audit log source used for detection and investigation. |
| Recommendation — Centralise DNS logs, retain them appropriately, and alert on suspicious query patterns. | ||
| NIST SP 800-53 Rev 5 | AU-12 — Audit Record Generation | DNS logging is the generation of audit records for name-resolution activity. |
| AU-6 — Audit Record Review, Analysis, and Reporting | DNS logs are only useful when reviewed for suspicious resolution activity and anomalies. | |
| AU-11 — Audit Record Retention | DNS logs depend on retention long enough to support hunting and post-incident review. | |
| Recommendation — Configure DNS components to generate the records needed for security monitoring and investigations. Review DNS telemetry for beaconing, unusual domains, and investigation pivots. Keep DNS records long enough to support investigations and compliance needs. | ||
| NIST CSF 2.0 | DE.CM-01 — The network and network devices are monitored to find potential cybersecurity events | DNS logging is a monitoring control for network security events and suspicious resolution activity. |
| Recommendation — Monitor DNS traffic as part of network security event detection. | ||
| MITRE ATT&CK | T1071.004 — Application Layer Protocol: DNS | DNS logging helps detect and investigate adversary use of DNS as a command-and-control channel. |
| Recommendation — Map suspicious DNS traffic to T1071.004 and hunt for command-and-control patterns. | ||
Related resources from NHI Mgmt Group
Deepen Your Knowledge
Free weekly newsletter
Subscribe to the NHI & AI Identity Journal
The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.
Bonus 33% off our NHI Course when you subscribe.
Reviewed and updated by the NHIMG editorial team on November 2, 2026.
NHI Mgmt Group — the #1 independent authority on Non-Human Identity, IAM, and Agentic AI security. nhimg.org