DNS logging and monitoring

DNS traffic analysis is commonly used to:

  • discover unknown devices that appear on the network;

  • monitor critical devices that have not issued a query within a predefined time window;

  • detect malware from young/esoteric domain lookups or consistent lookup failures; and

  • analyze host, subnet, or user behavioral patterns.

DNS traffic can quickly become overwhelming. To save resources, consider discarding any fields that will not be required for analysis.

According to RFC 7626 there are no specific privacy laws for DNS data collection, in any country. However, it is not clear if data protection directive 95/46/EC of the European Union includes DNS traffic collection.

DNS logs are available from a number of sources. DNS queries and responses are commonly sent and received in the form of packets over UDP. These packets and the ability to passively capture them is basically the same across all operating systems.

Another common source is the DNS Server itself as it receives queries from clients, processes them and returns the results. Although the DNS protocol is a common standard, the logging facilities implemented in each DNS Server can vary greatly across different operating systems. BIND 9 generates flat log files while Windows DNS Server employs Event Tracing for Windows (ETW) for managing its DNS events.

DNS audit logging vs DNS analytical logging

Although Windows DNS Server has two event tracing channels named Audit and Analytical, the advantage gained from classifying DNS events into these two categories, and treating them separately, is by no means proprietary and can be applied to other DNS Server environments.

A DNS Server is basically a highly specialized database server, yet it still retains the same low-level CRUD (Create, Read, Update, Delete) functionality of any other database. Analytical logging is focused primarily on client queries, the read operations, while DNS Audit Logging is focused on the remaining CRUD operations: creating, updating, and deleting DNS zone information. These are the most important operations to monitor from a security perspective since unauthorized access to them can lead to interruption of network services, data loss, and outages of other infrastructure services.

The goal of DNS audit logging is to maintain an audit trail of any changes to the DNS Server’s configuration, mainly for security purposes, while providing timely notification and easy access to any high severity events. By logging changes to any of the more than 40 DNS resource record (RR) types in zone files, security analysts will have the forensic information they need, should DNS records be maliciously or accidentally modified.

The realm of DNS analytical logging is completely different. The volume of data collected can be huge and the events being analyzed are typically not time-sensitive. The bulk of these DNS queries can be useful for producing metrics on user and application network traffic to various internal and external sites and services.

In the following two sections, the methods used to collect audit and analytical log data may differ greatly, but the goal of managing them separately remains the same.