{"record":{"id":"e1366263254dd8ec","repo":"vectordotdev/vector","slug":"global-log-schema-message-key-to-be-valid-path","errorCode":null,"errorMessage":"global log_schema.message_key to be valid path","messagePattern":"global log_schema\\.message_key to be valid path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/sinks/influxdb/logs.rs","lineNumber":318,"sourceCode":"            source_type_key,\n        } = validated;\n\n        let tls_settings = TlsSettings::from_options(self.tls.as_ref())?;\n        let client = HttpClient::new(tls_settings, cx.proxy())?;\n        let healthcheck = self.healthcheck(client.clone())?;\n\n        let request = self.request.into_settings();\n\n        // Resolve the `log_schema()` fallbacks here, after the global log schema\n        // has been initialized, so custom global log schema keys are honored.\n        let host_key = host_key\n            .clone()\n            .or_else(|| log_schema().host_key().cloned())\n            .expect(\"global log_schema.host_key to be valid path\");\n        let message_key = message_key\n            .clone()\n            .or_else(|| log_schema().message_key().cloned())\n            .expect(\"global log_schema.message_key to be valid path\");\n        let source_type_key = source_type_key\n            .clone()\n            .or_else(|| log_schema().source_type_key().cloned())\n            .expect(\"global log_schema.source_type_key to be valid path\");\n\n        let sink = InfluxDbLogsSink {\n            uri: uri.clone(),\n            token: token.inner().to_owned(),\n            protocol_version: *protocol_version,\n            measurement: measurement.clone(),\n            tags: tags.clone(),\n            transformer: self.encoding.clone(),\n            host_key,\n            message_key,\n            source_type_key,\n        };\n\n        let sink = BatchedHttpSink::new(","sourceCodeStart":300,"sourceCodeEnd":336,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/sinks/influxdb/logs.rs#L300-L336","documentation":"While building the InfluxDB logs sink, the message key falls back to the global log_schema().message_key(). If neither the configured nor the global message key exists, the expect panics because the sink cannot locate which event field holds the log message.","triggerScenarios":"Building the InfluxDB logs sink with log_schema.message_key unset/None AND the global default also unavailable (e.g. log schema globals modified so message_key() returns None).","commonSituations":"Custom log_schema configuration that omits message_key; programmatic startup with altered global schema defaults.","solutions":["Set log_schema.message_key in the Vector configuration","Restore default log schema settings (message_key defaults to 'message')","Return a config error instead of expect in the sink build","Verify only one log_schema block is defined and it is valid"],"exampleFix":"// vector config\n// before\nlog_schema:\n  host_key: host\n// after\nlog_schema:\n  host_key: host\n  message_key: message","handlingStrategy":"validation","validationCode":"// rust: verify the message key resolves before building the sink\nlet key = message_key.or_else(|| log_schema().message_key().cloned())\n    .ok_or_else(|| ConfigError::MissingField(\"log_schema.message_key\"))?;","typeGuard":"fn has_message_key(cfg: &LogSchemaConfig) -> bool { cfg.message_key.is_some() || log_schema().message_key().is_some() }","tryCatchPattern":"let message_key = message_key.or_else(|| log_schema().message_key().cloned())\n    .ok_or_else(|| anyhow!(\"log_schema.message_key must be a valid path\"))?;","preventionTips":["Define log_schema.message_key explicitly in production configs","Avoid stripping global log schema defaults","Surface schema problems as config errors during validation","Document inter-sink dependencies on global log schema keys"],"tags":["rust","influxdb","configuration","log-schema"],"backgroundTag":"missing-required-config-field","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}