]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
datamodel: logging: advanced debugging config
authorAleš <ales.mrazek@nic.cz>
Sat, 8 Jan 2022 23:46:33 +0000 (00:46 +0100)
committerAleš Mrázek <ales.mrazek@nic.cz>
Fri, 8 Apr 2022 14:17:53 +0000 (16:17 +0200)
manager/knot_resolver_manager/datamodel/config_schema.py
manager/knot_resolver_manager/datamodel/logging_config.py
manager/knot_resolver_manager/datamodel/templates/logging.lua.j2

index 23b6032721d603881fa562f648a7d39de2f25bf6..7231cacd041edfd6368c2dc01dfe0d42af1a48e6 100644 (file)
@@ -69,7 +69,7 @@ class KresConfig(SchemaNode):
     cache: DNS resolver cache configuration.
     dnssec: DNSSEC disabling/enabling and configuration.
     dns64: DNS64 disabling/enabling and configuration.
-    logging: Logging configuration.
+    logging: Logging and debugging configuration.
     lua: Custom Lua configuration.
     """
 
index cfe65bcdd8e0efaea2008d70665146fab90a0c63..0f93871c881a99fcca7148055227bc4a8aa63252 100644 (file)
@@ -2,6 +2,7 @@ from typing import List, Optional
 
 from typing_extensions import Literal, TypeAlias
 
+from knot_resolver_manager.datamodel.types import TimeUnit
 from knot_resolver_manager.utils import SchemaNode
 
 LogLevelEnum = Literal["crit", "err", "warning", "notice", "info", "debug"]
@@ -56,7 +57,23 @@ LogGroupsEnum: TypeAlias = Literal[
 ]
 
 
+class DebuggingSchema(SchemaNode):
+    assertion_abort: bool = False
+    assertion_fork: TimeUnit = TimeUnit("5m")
+
+
 class LoggingSchema(SchemaNode):
+    """
+    Logging and debugging configuration.
+
+    ---
+    level: Logging level for all processes.
+    target: Logging stream target for all processes.
+    group: List of groups for which 'debug' logging level is set.
+    debugging: Advanced debugging parameters for Knot Resolver daemon (kresd).
+    """
+
     level: LogLevelEnum = "notice"
     target: Optional[LogTargetEnum] = None
     groups: Optional[List[LogGroupsEnum]] = None
+    debugging: DebuggingSchema = DebuggingSchema()
index 388522a327563b593e3804a395d1d933fa9401b5..62b56f1973fb9c62a32779073d416637acebcd3a 100644 (file)
@@ -1,10 +1,10 @@
 -- logging.level
 log_level('{{ cfg.logging.level }}')
 
-{% if cfg.logging.target %}
+{% if cfg.logging.target -%}
 -- logging.target
 log_target('{{ cfg.logging.target }}')
-{% endif %}
+{%- endif %}
 
 {% if cfg.logging.groups %}
 -- logging.groups
@@ -15,4 +15,11 @@ log_groups({
 {% endif %}
 {% endfor %}
 })
-{% endif %}
\ No newline at end of file
+{% 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() }}
+