{"record":{"id":"f46c80a0f61ff7a0","repo":"TechnitiumSoftware/DnsServer","slug":"syslog-protocol-is-not-supported-protocol","errorCode":null,"errorMessage":"Syslog protocol is not supported: {protocol}","messagePattern":"Syslog protocol is not supported: (.+?)","errorType":"exception","errorClass":"NotSupportedException","httpStatus":null,"severity":"error","filePath":"Apps/LogExporterApp/Strategy/SyslogExportStrategy.cs","lineNumber":66,"sourceCode":"\n        #endregion\n\n        #region constructor\n\n        public SyslogExportStrategy(string address, int? port, string? protocol)\n        {\n            port ??= DEFAULT_PORT;\n            protocol ??= DEFAUL_PROTOCOL;\n\n            LoggerConfiguration conf = new LoggerConfiguration();\n\n            _sender = protocol.ToLowerInvariant() switch\n            {\n                \"tls\" => conf.WriteTo.TcpSyslog(address, port.Value, _appName, FramingType.OCTET_COUNTING, SyslogFormat.RFC5424, _facility, useTls: true).Enrich.FromLogContext().CreateLogger(),\n                \"tcp\" => conf.WriteTo.TcpSyslog(address, port.Value, _appName, FramingType.OCTET_COUNTING, SyslogFormat.RFC5424, _facility, useTls: false).Enrich.FromLogContext().CreateLogger(),\n                \"udp\" => conf.WriteTo.UdpSyslog(address, port.Value, _appName, SyslogFormat.RFC5424, _facility).Enrich.FromLogContext().CreateLogger(),\n                \"local\" => conf.WriteTo.LocalSyslog(_appName, _facility).Enrich.FromLogContext().CreateLogger(),\n                _ => throw new NotSupportedException(\"Syslog protocol is not supported: \" + protocol),\n            };\n\n            _formatter = new Rfc5424Formatter(_facility, _appName, null, _sdId, Environment.MachineName);\n        }\n\n        #endregion\n\n        #region IDisposable\n\n        public void Dispose()\n        {\n            if (!_disposed)\n            {\n                _sender.Dispose();\n\n                _disposed = true;\n            }\n        }","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/Apps/LogExporterApp/Strategy/SyslogExportStrategy.cs#L48-L84","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set the syslog target 'protocol' to one of: 'tls', 'tcp', 'udp', or 'local' (case-insensitive).","Use 'tls' for TLS-encrypted TCP syslog, 'tcp' for plaintext TCP, 'udp' for UDP, 'local' for the host's local syslog socket.","Reload the LogExporterApp config."],"exampleFix":"// before\n{ \"protocol\": \"ssl\", \"address\": \"syslog.example\", \"port\": 6514 }\n// after\n{ \"protocol\": \"tls\", \"address\": \"syslog.example\", \"port\": 6514 }","handlingStrategy":"validation","validationCode":"var supported = new[] { \"tls\", \"tcp\", \"udp\", \"local\" };\nstring p = (protocol ?? DEFAUL_PROTOCOL).ToLowerInvariant();\nif (!supported.Contains(p))\n    throw new ConfigValidationException($\"syslog 'protocol' must be one of {string.Join(\", \", supported)}; got '{protocol}'.\");","typeGuard":"static bool IsValidSyslogProtocol(string? v) => v is not null && new[]{\"tls\",\"tcp\",\"udp\",\"local\"}.Contains(v.ToLowerInvariant());","tryCatchPattern":null,"preventionTips":["Pre-validate the syslog 'protocol' field against the four supported values.","Default to 'udp' or 'tcp' when unsure rather than guessing names.","Document the supported set next to the config field."],"tags":["config","log-exporter","syslog","enum-switch","notsupported"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T05:17:29.042Z"}