Where to Find Windows DNS Server Logs

Where to Find Windows DNS Server Logs

SOC Prime Team
SOC Prime Team linkedin icon Follow

Windows DNS Server logs to three places in Event Viewer, plus an optional text file:

  • Microsoft → Windows → DNS-Server → Audit: zone and record changes. On by default on current Windows Server.
  • Microsoft → Windows → DNS-Server → Analytical: every query and response. Off by default and hidden until you show analytic logs.
  • DNS Server, under Applications and Services Logs: service-level events such as starts, stops and zone load errors.
  • The debug log, a text file you enable in DNS Manager, usually C:\Windows\System32\dns\dns.log.

The core export is one line from an elevated prompt:

wevtutil epl "Microsoft-Windows-DNSServer/Audit" C:\logs\dns_audit.evtx

Almost everything on a network makes DNS queries, malware included. Query logs expose DNS tunneling, domain-generation algorithms and calls to known-bad domains. Audit logs expose someone quietly changing records. Prime Core has {N} detection rules for DNS data, mapped to {M} MITRE ATT&CK techniques. Among them: command-and-control over DNS (T1071.004) and domain-generation algorithms (T1568.002).

Get Started for Free

Before you start

Query logging probably wasn’t on. The Analytical channel is off by default. If you’re investigating something that already happened, there are likely no query logs from the server. Your options are the client side (Sysmon event 22, or the DNS Client log), firewall or proxy logs, or a network sensor. Turning it on now helps from here forward.

Turn on query logging (for the future). In Event Viewer, choose View → Show Analytic and Debug Logs, then right-click Analytical under DNS-Server and choose Enable Log. Or from the command line:

wevtutil sl "Microsoft-Windows-DNSServer/Analytical" /e:true

Microsoft describes the overhead as modest, but on a very busy resolver, test before you leave it on.

You need an elevated prompt, on the DNS server or on a domain controller running DNS.

Export the logs

:: record and zone changes

wevtutil epl "Microsoft-Windows-DNSServer/Audit" C:\logs\dns_audit.evtx


:: service-level events

wevtutil epl "DNS Server" C:\logs\dns_server.evtx


:: queries and responses (only if Analytical was enabled)

wevtutil epl "Microsoft-Windows-DNSServer/Analytical" C:\logs\dns_analytical.evtx

Analytic channels behave differently from normal logs. Event Viewer may ask you to disable the log before it shows events. PowerShell’s Get-WinEvent reads them only with -Oldest. 

The debug log is plain text, configured in DNS Manager → server Properties → Debug Logging. It records packets in detail, and it rolls over when it hits its size limit, overwriting older entries. Copy it as-is: copy C:\Windows\System32\dns\dns.log C:\logs\. 

What to look for

SignalWhat it can mean
Very long, random-looking subdomains in queriesDNS tunneling, data smuggled out in query names
One client generating many failed lookups (NXDOMAIN)Malware cycling through generated domains
A high volume of TXT queries from one hostTunneling or command-and-control
Audit events for records created, deleted or changed outside change windowsRecord hijacking, e.g. a new wpad record
A plugin DLL loaded by the DNS Server serviceAbuse of the DnsAdmins group to run code as SYSTEM

Upload and review in LogTotal

LogTotal reads EVTX natively. One thing to know first: LogTotal doesn’t sanitize EVTX files yet. DNS logs carry internal hostnames and client IPs. Treat an upload as handing over the raw file: fine for test servers; for production, get a yes from whoever owns data handling first.

If you need sanitization today, convert to JSON first: evtx_dump -o jsonl dns_audit.evtx > dns_audit.jsonl. 

  1. Upload. Open logtotal.com and drop in the file.
  2. Review.

When it goes wrong

SymptomLikely causeFix
No Analytical channel in Event ViewerAnalytic logs are hidden by defaultView → Show Analytic and Debug Logs
Analytical channel is emptyIt was never enabledEnable it; no history before that
Get-WinEvent errors on the Analytical logAnalytic logs need -OldestAdd -Oldest
Audit channel missingOlder Windows Server without the updateCheck the OS version; use the debug log
Debug log covers only a short timeIt overwrote itself at the size limitRaise the limit, or forward logs elsewhere

FAQ

Server logs or client logs?

The DNS server tells you which client IP asked. Only the client tells you which process asked. That’s why Sysmon event 22 on endpoints complements server logs so well.

Is the debug log better than the Analytical channel?

The debug log holds more packet detail but costs more and overwrites itself. For most investigations, the Analytical channel is the better default.

Join SOC Prime's Detection as Code platform to improve visibility into threats most relevant to your business. To help you get started and drive immediate value, book a meeting now with SOC Prime experts.