dnstap
DNSTAP Source
The DNSTAP source collects DNS query and response logs from servers that support the dnstap protocol. It listens for incoming DNSTAP frames over TCP or Unix domain sockets and emits decoded DNS events into the telemetry pipeline.
This source is commonly used in environments where DNS observability, security analysis, and traffic inspection are required, such as enterprise networks, ISPs, and security-focused deployments.
Collection Model
The DNSTAP source operates as a passive listener. A DNSTAP-compatible DNS server actively pushes DNS events to the configured socket endpoint.
Collected events may include:
- DNS queries
- DNS responses
- Resolver and authoritative server activity
- Client and server metadata
Events are processed in real time and forwarded downstream without persistent state.
Socket Modes
The source supports two socket types:
- TCP socket: Suitable for network-based DNS servers and distributed environments.
- Unix domain socket: Commonly used for local DNS servers running on the same host for lower latency and reduced overhead.
The socket mode determines which configuration options are applicable.
Network Binding
address (required, string)
Defines the socket address to listen on when using TCP mode.
The address must include a port number. Alternatively, systemd socket activation can be used to inherit an existing socket.
Relevant when:
- mode = "tcp"
socket_path (required, string)
Defines the absolute filesystem path of the Unix domain socket used to receive DNSTAP data.
The socket file is created automatically if it does not exist.
Relevant when:
- mode = "unix"
Connection Management (TCP)
connection_limit (optional, uint)
Limits the maximum number of concurrent TCP connections.
This prevents resource exhaustion in high-throughput or untrusted environments.
max_connection_duration_secs (optional, uint)
Defines the maximum lifetime of a single TCP connection.
Connections exceeding this duration are closed automatically, which can help with load balancing and long-lived connection management.
keepalive (optional, object)
Controls TCP keepalive behavior for idle connections.
This helps detect broken connections and release resources proactively.
shutdown_timeout_secs (optional, uint)
Specifies how long the source waits for active connections to close gracefully during shutdown before forcefully terminating them.
Frame Processing
max_frame_length (optional, uint)
Defines the maximum accepted DNSTAP frame size.
Frames exceeding this limit are discarded to protect the system from oversized payloads.
max_frame_handling_tasks (optional, uint)
Limits the number of DNSTAP frames that can be processed concurrently.
This setting directly impacts throughput and resource usage.
multithreaded (optional, bool)
Enables concurrent processing of DNSTAP frames.
When enabled, multiple frames can be decoded and processed in parallel to improve performance under high load.
raw_data_only (optional, bool)
When enabled, DNSTAP frames are not parsed or decoded.
Instead, the raw frame payload is attached to each event as a base64-encoded field. This mode is useful for:
- Custom parsing pipelines
- Forensic analysis
- Downstream decoding
DNS Normalization
lowercase_hostnames (optional, bool)
Controls whether all DNS hostnames are normalized to lowercase.
Enabling this improves consistency and simplifies downstream querying and aggregation.
Access Control
permit_origin (optional, [string])
Defines a list of allowed client IP networks using CIDR notation.
Only connections originating from these networks are accepted.
Relevant when:
- mode = "tcp"
Metadata Enrichment
host_key (optional, string)
Overrides the field name used to attach the source host information to each log event.
The value added corresponds to the socket address or socket path.
port_key (optional, string)
Overrides the field name used to record the peer’s port number.
Setting this value to an empty string suppresses port metadata entirely.
Relevant when:
- mode = "tcp"
Buffer Configuration
receive_buffer_bytes (optional, uint)
Controls the size of the receive buffer for each TCP connection.
Adjusting this may improve performance under high-throughput conditions.
socket_receive_buffer_size (optional, uint)
socket_send_buffer_size (optional, uint)
Define receive and send buffer sizes for Unix domain sockets.
System-wide kernel buffer limits may need adjustment when increasing these values.
Relevant when:
- mode = "unix"
Unix Socket Permissions
socket_file_mode (optional, uint)
Specifies file permission bits applied to the Unix domain socket.
This controls which users and processes are allowed to send DNSTAP data to the source.
TLS Configuration
tls (optional, object)
Enables TLS encryption and client authentication for TCP connections.
TLS can be used to:
- Encrypt DNSTAP traffic
- Authenticate DNS servers
- Attach client certificate metadata to events
Certificate Verification
When enabled, TLS verification ensures:
- Certificates are valid and trusted
- Certificate chains are complete
- Hostnames match certificate identities (when applicable)
Disabling verification significantly weakens security and should only be done in controlled environments.
Reliability Considerations
- Events are delivered using best-effort semantics
- No acknowledgements are supported
- Network interruptions or overload may cause data loss
- Reliability guarantees should be enforced downstream
Common Deployment Scenarios
- Passive DNS traffic monitoring
- DNS security analytics and threat detection
- Network observability pipelines
- ISP and enterprise DNS telemetry collection
- Integration with SIEM and log analytics platforms