TechnitiumSoftware/DnsServer · error · NotSupportedException

Syslog protocol is not supported: {protocol}

Error message

Syslog protocol is not supported: {protocol}

What it means

Thrown by the SyslogExportStrategy constructor when the 'protocol' field does not match one of the four supported values. The switch expression handles 'tls', 'tcp', 'udp', and 'local'; any other value hits the discard branch and throws NotSupportedException. It prevents the strategy from silently choosing a wrong transport.

Source

Thrown at Apps/LogExporterApp/Strategy/SyslogExportStrategy.cs:66

        #endregion

        #region constructor

        public SyslogExportStrategy(string address, int? port, string? protocol)
        {
            port ??= DEFAULT_PORT;
            protocol ??= DEFAUL_PROTOCOL;

            LoggerConfiguration conf = new LoggerConfiguration();

            _sender = protocol.ToLowerInvariant() switch
            {
                "tls" => conf.WriteTo.TcpSyslog(address, port.Value, _appName, FramingType.OCTET_COUNTING, SyslogFormat.RFC5424, _facility, useTls: true).Enrich.FromLogContext().CreateLogger(),
                "tcp" => conf.WriteTo.TcpSyslog(address, port.Value, _appName, FramingType.OCTET_COUNTING, SyslogFormat.RFC5424, _facility, useTls: false).Enrich.FromLogContext().CreateLogger(),
                "udp" => conf.WriteTo.UdpSyslog(address, port.Value, _appName, SyslogFormat.RFC5424, _facility).Enrich.FromLogContext().CreateLogger(),
                "local" => conf.WriteTo.LocalSyslog(_appName, _facility).Enrich.FromLogContext().CreateLogger(),
                _ => throw new NotSupportedException("Syslog protocol is not supported: " + protocol),
            };

            _formatter = new Rfc5424Formatter(_facility, _appName, null, _sdId, Environment.MachineName);
        }

        #endregion

        #region IDisposable

        public void Dispose()
        {
            if (!_disposed)
            {
                _sender.Dispose();

                _disposed = true;
            }
        }

View on GitHub (pinned to d0484b6c1e)

Solutions

  1. Set the syslog target 'protocol' to one of: 'tls', 'tcp', 'udp', or 'local' (case-insensitive).
  2. Use 'tls' for TLS-encrypted TCP syslog, 'tcp' for plaintext TCP, 'udp' for UDP, 'local' for the host's local syslog socket.
  3. Reload the LogExporterApp config.

Example fix

// before
{ "protocol": "ssl", "address": "syslog.example", "port": 6514 }
// after
{ "protocol": "tls", "address": "syslog.example", "port": 6514 }
Defensive patterns

Strategy: validation

Validate before calling

var supported = new[] { "tls", "tcp", "udp", "local" };
string p = (protocol ?? DEFAUL_PROTOCOL).ToLowerInvariant();
if (!supported.Contains(p))
    throw new ConfigValidationException($"syslog 'protocol' must be one of {string.Join(", ", supported)}; got '{protocol}'.");

Type guard

static bool IsValidSyslogProtocol(string? v) => v is not null && new[]{"tls","tcp","udp","local"}.Contains(v.ToLowerInvariant());

Prevention

When it happens

Trigger: The LogExporter syslog target config sets 'protocol' to something other than tls/tcp/udp/local (case-sensitive match after ToLowerInvariant on the input). Examples: 'ssl', 'syslog', 'rfc5424', or an empty string.

Common situations: Operator guesses the protocol name ('ssl' instead of 'tls', 'tcp_tls'), copies a value from a different syslog library, or leaves the field as an unrecognised placeholder.

Related errors


AI-assisted analysis of TechnitiumSoftware/DnsServer@d0484b6c1e (2026-08-13). Data as JSON: /api/errors/f46c80a0f61ff7a0. Report an issue: GitHub.