{"record":{"id":"6602d1e2247813d7","repo":"vectordotdev/vector","slug":"valid-message-key","errorCode":null,"errorMessage":"valid message key","messagePattern":"valid message key","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"lib/codecs/src/decoding/format/syslog.rs","lineNumber":69,"sourceCode":"            source: self.source,\n            lossy: self.syslog.lossy,\n        }\n    }\n\n    /// Return the type of event build by this deserializer.\n    pub fn output_type(&self) -> DataType {\n        DataType::Log\n    }\n\n    /// The schema produced by the deserializer.\n    pub fn schema_definition(&self, log_namespace: LogNamespace) -> schema::Definition {\n        match (log_namespace, self.source) {\n            (LogNamespace::Legacy, _) => {\n                let mut definition = schema::Definition::empty_legacy_namespace()\n                    // The `message` field is always defined. If parsing fails, the entire body becomes the\n                    // message.\n                    .with_event_field(\n                        log_schema().message_key().expect(\"valid message key\"),\n                        Kind::bytes(),\n                        Some(\"message\"),\n                    );\n\n                if let Some(timestamp_key) = log_schema().timestamp_key() {\n                    // All other fields are optional.\n                    definition = definition.optional_field(\n                        timestamp_key,\n                        Kind::timestamp(),\n                        Some(\"timestamp\"),\n                    )\n                }\n\n                definition = definition\n                    .optional_field(&owned_value_path!(\"hostname\"), Kind::bytes(), Some(\"host\"))\n                    .optional_field(\n                        &owned_value_path!(\"severity\"),\n                        Kind::bytes(),","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/codecs/src/decoding/format/syslog.rs#L51-L87","documentation":"Panic via `.expect(\"valid message key\")` in the syslog deserializer's `schema_definition` (lib/codecs/src/decoding/format/syslog.rs). The deserializer declares the schema for the standard `message` field using the global log schema's configured key, but `log_schema().message_key()` is an `Option`: when the deployment's global `[log_schema]` config sets `message_key = \"\"` (unset), it returns `None` and building the schema definition panics. The syslog decoder fundamentally assumes a message key exists, because on parse failure the entire body becomes the message.","triggerScenarios":"Running with a `syslog` source (or the syslog codec) while the global config contains `[log_schema] message_key = \"\"`. The panic fires when the codec's schema definition is queried (config build/startup or schema inspection), not per event.","commonSituations":"Operators disabling the default `message` key globally (e.g. to normalize schemas for a downstream that forbids it), then adding a syslog source; test setups with a minimal global config that clears standard keys.","solutions":["Set a non-empty message key in the global log schema: `[log_schema] message_key = \"msg\"`","Or remove the `message_key = \"\"` override entirely to restore the default `message`","If you truly need no message key, don't use the syslog source/codec — decode with a codec that doesn't assume one"],"exampleFix":"# before\n[log_schema]\nmessage_key = \"\"\n\n[sources.in]\ntype = \"syslog\"\n\n# after\n[log_schema]\nmessage_key = \"message\"\n\n[sources.in]\ntype = \"syslog\"","handlingStrategy":"validation","validationCode":"// Guard before using the syslog codec: global log schema must have a message key\nuse vector_core::config::log_schema;\nassert!(\n    log_schema().message_key().is_some(),\n    \"syslog codec requires a non-empty log_schema.message_key\"\n);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never set [log_schema] message_key = \"\" in deployments that use the syslog source/codec","Regression-test custom global log_schema configs together with syslog sources","Treat 'codec assumes a standard key' as a contract when renaming global schema keys"],"tags":["rust","vector","panic","log-schema","syslog","configuration"],"backgroundTag":"log-schema-message-key-missing","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}