Skip to content

Logging

LoggingBlock pydantic-model

Bases: BindBaseModel

Logging block for BIND9 configuration.

Configures logging options for the name server.

Block Grammar:

logging {
    category <string> { <string>; ... };
    channel <string> {
        buffered <boolean>;
        file <quoted_string> [ versions ( unlimited | <integer> ) ] [ size <size> ] [ suffix ( increment | timestamp ) ];
        null;
        print-category <boolean>;
        print-severity <boolean>;
        print-time ( iso8601 | iso8601-utc | local | <boolean> );
        severity <log_severity>;
        stderr;
        syslog [ <syslog_facility> ];
    };
};

Show JSON schema:
{
  "$defs": {
    "FileSuffixEnum": {
      "enum": [
        "increment",
        "timestamp"
      ],
      "title": "FileSuffixEnum",
      "type": "string"
    },
    "LogCategory": {
      "description": "Log category definition for BIND9 logging configuration.\n\nGrammar:\n```\ncategory <string> { <string>; ... };\n```",
      "properties": {
        "comment": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional comment for this block",
          "title": "Comment"
        },
        "name": {
          "$ref": "#/$defs/LogCategoryEnum",
          "description": "Category name"
        },
        "channels": {
          "description": "List of channel names to receive messages from this category",
          "items": {
            "type": "string"
          },
          "title": "Channels",
          "type": "array"
        }
      },
      "required": [
        "name"
      ],
      "title": "LogCategory",
      "type": "object"
    },
    "LogCategoryEnum": {
      "enum": [
        "client",
        "cname",
        "config",
        "database",
        "default",
        "dispatch",
        "dnssec",
        "dnstap",
        "edns-disabled",
        "general",
        "lame-servers",
        "network",
        "notify",
        "nsid",
        "queries",
        "query-errors",
        "rate-limit",
        "resolver",
        "responses",
        "rpz",
        "rpz-passthru",
        "security",
        "serve-stale",
        "spill",
        "sslkeylog",
        "trust-anchor-telemetry",
        "unmatched",
        "update",
        "update-security",
        "xfer-in",
        "xfer-out",
        "zoneload"
      ],
      "title": "LogCategoryEnum",
      "type": "string"
    },
    "LogChannel": {
      "description": "Log channel definition for BIND9 logging configuration.\n\nGrammar:\n```\nchannel <string> {\n    buffered <boolean>;\n    file <quoted_string> [ versions ( unlimited | <integer> ) ] [ size <size> ] [ suffix ( increment | timestamp ) ];\n    null;\n    print-category <boolean>;\n    print-severity <boolean>;\n    print-time ( iso8601 | iso8601-utc | local | <boolean> );\n    severity <log_severity>;\n    stderr;\n    syslog [ <syslog_facility> ];\n};\n```",
      "properties": {
        "comment": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Optional comment for this block",
          "title": "Comment"
        },
        "name": {
          "description": "Channel name",
          "title": "Name",
          "type": "string"
        },
        "file": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Log to specified file. Mutually exclusive with syslog/stderr/null",
          "title": "File"
        },
        "syslog": {
          "anyOf": [
            {
              "$ref": "#/$defs/SyslogFacilityEnum"
            },
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Log to syslog with optional facility. Mutually exclusive with file/stderr/null",
          "title": "Syslog"
        },
        "stderr": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Log to standard error. Mutually exclusive with file/syslog/null",
          "title": "Stderr"
        },
        "null": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Discard all messages. Mutually exclusive with file/syslog/stderr",
          "title": "Null"
        },
        "versions": {
          "anyOf": [
            {
              "const": "unlimited",
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Number of backup versions to keep (unlimited or integer)",
          "title": "Versions"
        },
        "size": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Maximum file size before rotation",
          "title": "Size"
        },
        "suffix": {
          "anyOf": [
            {
              "$ref": "#/$defs/FileSuffixEnum"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Backup file naming method"
        },
        "buffered": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "If yes, output is not flushed after each log entry",
          "title": "Buffered"
        },
        "print_category": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Include category name in log messages",
          "title": "Print Category"
        },
        "print_severity": {
          "anyOf": [
            {
              "type": "boolean"
            },
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Include severity level in log messages",
          "title": "Print Severity"
        },
        "print_time": {
          "anyOf": [
            {
              "$ref": "#/$defs/TimeFormatEnum"
            },
            {
              "type": "boolean"
            },
            {
              "type": "string"
            },
            {
              "type": "integer"
            },
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Include timestamp in log messages",
          "title": "Print Time"
        },
        "severity": {
          "anyOf": [
            {
              "$ref": "#/$defs/LogSeverityEnum"
            },
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "default": null,
          "description": "Minimum severity level to log",
          "title": "Severity"
        }
      },
      "required": [
        "name"
      ],
      "title": "LogChannel",
      "type": "object"
    },
    "LogSeverityEnum": {
      "enum": [
        "critical",
        "error",
        "warning",
        "notice",
        "info",
        "debug",
        "dynamic"
      ],
      "title": "LogSeverityEnum",
      "type": "string"
    },
    "SyslogFacilityEnum": {
      "enum": [
        "kern",
        "user",
        "mail",
        "daemon",
        "auth",
        "syslog",
        "lpr",
        "news",
        "uucp",
        "cron",
        "authpriv",
        "ftp",
        "local0",
        "local1",
        "local2",
        "local3",
        "local4",
        "local5",
        "local6",
        "local7"
      ],
      "title": "SyslogFacilityEnum",
      "type": "string"
    },
    "TimeFormatEnum": {
      "enum": [
        "iso8601",
        "iso8601-utc",
        "local"
      ],
      "title": "TimeFormatEnum",
      "type": "string"
    }
  },
  "description": "Logging block for BIND9 configuration.\n\nConfigures logging options for the name server.\n\nBlock Grammar:\n```\nlogging {\n    category <string> { <string>; ... };\n    channel <string> {\n        buffered <boolean>;\n        file <quoted_string> [ versions ( unlimited | <integer> ) ] [ size <size> ] [ suffix ( increment | timestamp ) ];\n        null;\n        print-category <boolean>;\n        print-severity <boolean>;\n        print-time ( iso8601 | iso8601-utc | local | <boolean> );\n        severity <log_severity>;\n        stderr;\n        syslog [ <syslog_facility> ];\n    };\n};\n```",
  "properties": {
    "comment": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional comment for this block",
      "title": "Comment"
    },
    "channels": {
      "description": "List of log channel definitions",
      "items": {
        "$ref": "#/$defs/LogChannel"
      },
      "title": "Channels",
      "type": "array"
    },
    "categories": {
      "description": "List of log category definitions",
      "items": {
        "$ref": "#/$defs/LogCategory"
      },
      "title": "Categories",
      "type": "array"
    }
  },
  "title": "LoggingBlock",
  "type": "object"
}

Fields:

Validators:

channels pydantic-field

channels: list[LogChannel]

List of log channel definitions

categories pydantic-field

categories: list[LogCategory]

List of log category definitions

validate_channel_references pydantic-validator

validate_channel_references() -> LoggingBlock

Validate that categories reference existing channels or built-in channels.

LogChannel pydantic-model

Bases: BindBaseModel

Log channel definition for BIND9 logging configuration.

Grammar:

channel <string> {
    buffered <boolean>;
    file <quoted_string> [ versions ( unlimited | <integer> ) ] [ size <size> ] [ suffix ( increment | timestamp ) ];
    null;
    print-category <boolean>;
    print-severity <boolean>;
    print-time ( iso8601 | iso8601-utc | local | <boolean> );
    severity <log_severity>;
    stderr;
    syslog [ <syslog_facility> ];
};

Show JSON schema:
{
  "$defs": {
    "FileSuffixEnum": {
      "enum": [
        "increment",
        "timestamp"
      ],
      "title": "FileSuffixEnum",
      "type": "string"
    },
    "LogSeverityEnum": {
      "enum": [
        "critical",
        "error",
        "warning",
        "notice",
        "info",
        "debug",
        "dynamic"
      ],
      "title": "LogSeverityEnum",
      "type": "string"
    },
    "SyslogFacilityEnum": {
      "enum": [
        "kern",
        "user",
        "mail",
        "daemon",
        "auth",
        "syslog",
        "lpr",
        "news",
        "uucp",
        "cron",
        "authpriv",
        "ftp",
        "local0",
        "local1",
        "local2",
        "local3",
        "local4",
        "local5",
        "local6",
        "local7"
      ],
      "title": "SyslogFacilityEnum",
      "type": "string"
    },
    "TimeFormatEnum": {
      "enum": [
        "iso8601",
        "iso8601-utc",
        "local"
      ],
      "title": "TimeFormatEnum",
      "type": "string"
    }
  },
  "description": "Log channel definition for BIND9 logging configuration.\n\nGrammar:\n```\nchannel <string> {\n    buffered <boolean>;\n    file <quoted_string> [ versions ( unlimited | <integer> ) ] [ size <size> ] [ suffix ( increment | timestamp ) ];\n    null;\n    print-category <boolean>;\n    print-severity <boolean>;\n    print-time ( iso8601 | iso8601-utc | local | <boolean> );\n    severity <log_severity>;\n    stderr;\n    syslog [ <syslog_facility> ];\n};\n```",
  "properties": {
    "comment": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional comment for this block",
      "title": "Comment"
    },
    "name": {
      "description": "Channel name",
      "title": "Name",
      "type": "string"
    },
    "file": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Log to specified file. Mutually exclusive with syslog/stderr/null",
      "title": "File"
    },
    "syslog": {
      "anyOf": [
        {
          "$ref": "#/$defs/SyslogFacilityEnum"
        },
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Log to syslog with optional facility. Mutually exclusive with file/stderr/null",
      "title": "Syslog"
    },
    "stderr": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Log to standard error. Mutually exclusive with file/syslog/null",
      "title": "Stderr"
    },
    "null": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Discard all messages. Mutually exclusive with file/syslog/stderr",
      "title": "Null"
    },
    "versions": {
      "anyOf": [
        {
          "const": "unlimited",
          "type": "string"
        },
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Number of backup versions to keep (unlimited or integer)",
      "title": "Versions"
    },
    "size": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Maximum file size before rotation",
      "title": "Size"
    },
    "suffix": {
      "anyOf": [
        {
          "$ref": "#/$defs/FileSuffixEnum"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Backup file naming method"
    },
    "buffered": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        },
        {
          "type": "integer"
        },
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "If yes, output is not flushed after each log entry",
      "title": "Buffered"
    },
    "print_category": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        },
        {
          "type": "integer"
        },
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Include category name in log messages",
      "title": "Print Category"
    },
    "print_severity": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "string"
        },
        {
          "type": "integer"
        },
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Include severity level in log messages",
      "title": "Print Severity"
    },
    "print_time": {
      "anyOf": [
        {
          "$ref": "#/$defs/TimeFormatEnum"
        },
        {
          "type": "boolean"
        },
        {
          "type": "string"
        },
        {
          "type": "integer"
        },
        {
          "type": "number"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Include timestamp in log messages",
      "title": "Print Time"
    },
    "severity": {
      "anyOf": [
        {
          "$ref": "#/$defs/LogSeverityEnum"
        },
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Minimum severity level to log",
      "title": "Severity"
    }
  },
  "required": [
    "name"
  ],
  "title": "LogChannel",
  "type": "object"
}

Fields:

Validators:

name pydantic-field

name: string_BIND

Channel name

file pydantic-field

file: quoted_string_BIND | None = None

Log to specified file. Mutually exclusive with syslog/stderr/null

syslog pydantic-field

syslog: SyslogFacilityEnum | str | None = None

Log to syslog with optional facility. Mutually exclusive with file/stderr/null

stderr pydantic-field

stderr: bool | None = None

Log to standard error. Mutually exclusive with file/syslog/null

null pydantic-field

null: bool | None = None

Discard all messages. Mutually exclusive with file/syslog/stderr

versions pydantic-field

versions: Literal['unlimited'] | integer_BIND | None = None

Number of backup versions to keep (unlimited or integer)

size pydantic-field

size: size_BIND | None = None

Maximum file size before rotation

suffix pydantic-field

suffix: FileSuffixEnum | None = None

Backup file naming method

buffered pydantic-field

buffered: boolean_BIND | None = None

If yes, output is not flushed after each log entry

print_category pydantic-field

print_category: boolean_BIND | None = None

Include category name in log messages

print_severity pydantic-field

print_severity: boolean_BIND | None = None

Include severity level in log messages

print_time pydantic-field

print_time: TimeFormatEnum | boolean_BIND | None = None

Include timestamp in log messages

severity pydantic-field

severity: LogSeverityEnum | str | None = None

Minimum severity level to log

validate_destination_exclusivity pydantic-validator

validate_destination_exclusivity() -> LogChannel

Ensure exactly one destination is specified.

validate_severity pydantic-validator

validate_severity(
    v: LogSeverityEnum | str | None,
) -> LogSeverityEnum | str | None

Validate severity value.

validate_syslog_facility pydantic-validator

validate_syslog_facility(
    v: SyslogFacilityEnum | str | None,
) -> SyslogFacilityEnum | None

Validate syslog facility.

LogCategory pydantic-model

Bases: BindBaseModel

Log category definition for BIND9 logging configuration.

Grammar:

category <string> { <string>; ... };

Show JSON schema:
{
  "$defs": {
    "LogCategoryEnum": {
      "enum": [
        "client",
        "cname",
        "config",
        "database",
        "default",
        "dispatch",
        "dnssec",
        "dnstap",
        "edns-disabled",
        "general",
        "lame-servers",
        "network",
        "notify",
        "nsid",
        "queries",
        "query-errors",
        "rate-limit",
        "resolver",
        "responses",
        "rpz",
        "rpz-passthru",
        "security",
        "serve-stale",
        "spill",
        "sslkeylog",
        "trust-anchor-telemetry",
        "unmatched",
        "update",
        "update-security",
        "xfer-in",
        "xfer-out",
        "zoneload"
      ],
      "title": "LogCategoryEnum",
      "type": "string"
    }
  },
  "description": "Log category definition for BIND9 logging configuration.\n\nGrammar:\n```\ncategory <string> { <string>; ... };\n```",
  "properties": {
    "comment": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Optional comment for this block",
      "title": "Comment"
    },
    "name": {
      "$ref": "#/$defs/LogCategoryEnum",
      "description": "Category name"
    },
    "channels": {
      "description": "List of channel names to receive messages from this category",
      "items": {
        "type": "string"
      },
      "title": "Channels",
      "type": "array"
    }
  },
  "required": [
    "name"
  ],
  "title": "LogCategory",
  "type": "object"
}

Fields:

Validators:

name pydantic-field

name: LogCategoryEnum

Category name

channels pydantic-field

channels: list[string_BIND]

List of channel names to receive messages from this category

LogCategoryEnum

Bases: str, Enum

LogSeverityEnum

Bases: str, Enum

FileSuffixEnum

Bases: str, Enum

SyslogFacilityEnum

Bases: str, Enum

TimeFormatEnum

Bases: str, Enum