{"record":{"id":"993c8985759159a9","repo":"vectordotdev/vector","slug":"valid-host-key","errorCode":null,"errorMessage":"valid host key","messagePattern":"valid host key","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/transforms/metric_to_log.rs","lineNumber":248,"sourceCode":"                None,\n            );\n\n            // This is added as a \"marker\" field to determine which namespace is being used at runtime.\n            // This is normally handled automatically by sources, but this is a special case.\n            schema_definition = schema_definition.with_metadata_field(\n                &owned_value_path!(\"vector\"),\n                Kind::object(Collection::empty()),\n                None,\n            );\n        }\n        LogNamespace::Legacy => {\n            if let Some(timestamp_key) = log_schema().timestamp_key() {\n                schema_definition =\n                    schema_definition.with_event_field(timestamp_key, Kind::timestamp(), None);\n            }\n\n            schema_definition = schema_definition.with_event_field(\n                log_schema().host_key().expect(\"valid host key\"),\n                Kind::bytes().or_undefined(),\n                None,\n            );\n        }\n    }\n    schema_definition\n}\n\n#[derive(Clone, Debug)]\npub struct MetricToLog {\n    host_tag: Option<OwnedValuePath>,\n    timezone: TimeZone,\n    log_namespace: LogNamespace,\n    tag_values: MetricTagValues,\n}\n\nimpl MetricToLog {\n    pub fn new(","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/src/transforms/metric_to_log.rs#L230-L266","documentation":"`log_schema().host_key()` returns an Option; metric_to_log requires it when building the schema definition for the Legacy log namespace (src/transforms/metric_to_log.rs:248). If the global `log_schema.host_key` is unset, blank, or unparseable as a value path, `expect(\"valid host key\")` panics while the transform's type definition is assembled at config-load time.","triggerScenarios":"A metric_to_log transform in a pipeline with a top-level `log_schema:` override whose `host_key` is missing, empty, or an invalid path expression.","commonSituations":"Operators customizing log_schema (e.g. renaming host to hostname) who blank or mistype the value; YAML indentation mistakes placing host_key under a component instead of log_schema.","solutions":["Set `log_schema.host_key` to a valid simple path (default `host`) at the top level of the configuration","Run `vector validate <config>` to catch schema errors before deploy","If embedding: replace the expect with a propagated configuration error"],"exampleFix":"# before\nlog_schema:\n  timestamp_key: ts\n  # host_key missing or blank\n# after\nlog_schema:\n  host_key: host\n  timestamp_key: ts","handlingStrategy":"validation","validationCode":"# shell: ensure every log_schema key used by Legacy-namespace transforms is set\nvector validate /etc/vector/vector.yaml --no-environment\ngrep -A6 '^log_schema:' /etc/vector/vector.yaml   # message/host/timestamp keys present","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When overriding log_schema, always specify message_key, host_key, and timestamp_key explicitly","Validate configs in CI with `vector validate`","Watch for YAML indentation that detaches keys from the log_schema block"],"tags":["log-schema","metric-to-log","configuration","panic"],"backgroundTag":"invalid-log-schema-key","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}