-from typing import List, Optional
+from typing import List, Optional, Union
from typing_extensions import Literal, TypeAlias
-from knot_resolver_manager.datamodel.types import TimeUnit
+from knot_resolver_manager.datamodel.types import CheckedPath, TimeUnit
from knot_resolver_manager.utils import SchemaNode
LogLevelEnum = Literal["crit", "err", "warning", "notice", "info", "debug"]
]
+class DnstapSchema(SchemaNode):
+ """
+ Logging DNS queries and responses to a unix socket
+
+ ---
+ unix_socket: The unix socket file where dnstap messages will be sent.
+ log_queries: If true queries from downstream in wire format will be logged.
+ log_responses: If true responses to downstream in wire format will be logged.
+ log_tcp_rtt: If true TCP RTT (Round-trip time) will be logged.
+ """
+
+ unix_socket: CheckedPath
+ log_queries: bool = True
+ log_responses: bool = True
+ log_tcp_rtt: bool = True
+
+
class DebuggingSchema(SchemaNode):
assertion_abort: bool = False
assertion_fork: TimeUnit = TimeUnit("5m")
target: Logging stream target for all processes.
groups: List of groups for which 'debug' logging level is set.
debugging: Advanced debugging parameters for Knot Resolver daemon (kresd).
+ dnstap: Logging DNS requests and responses to a unix socket.
"""
level: LogLevelEnum = "notice"
target: Optional[LogTargetEnum] = None
groups: Optional[List[LogGroupsEnum]] = None
+ dnstap: Union[Literal[False], DnstapSchema] = False
debugging: DebuggingSchema = DebuggingSchema()
})
{% endif %}
+{% if cfg.logging.dnstap -%}
+-- logging.dnstap
+modules.load('dnstap')
+dnstap.config({
+ socket_path = '{{ cfg.logging.dnstap.unix_socket }}',
+ client = {
+ log_queries = {{ 'true' if cfg.logging.dnstap.log_queries else 'false' }},
+ log_responses = {{ 'true' if cfg.logging.dnstap.log_responses else 'false' }},
+ log_tcp_rtt = {{ 'true' if cfg.logging.dnstap.log_tcp_rtt else 'false' }}
+ }
+})
+{%- endif %}
+
-- logging.debugging.assertion-abort
debugging.assertion_abort = {{ 'true' if cfg.logging.debugging.assertion_abort else 'false' }}
-- logging.debugging.assertion-fork
debugging.assertion_fork = {{ cfg.logging.debugging.assertion_fork.millis() }}
-