vectordotdev/vector · error

global log_schema.host_key to be valid path

Error message

global log_schema.host_key to be valid path

What it means

During Datadog Agent source construction, the global log schema's host key is converted to a target path; .expect("global log_schema.host_key to be valid path") panics if the configured host key string is not a valid event path. This indicates a broken global `log_schema.host_key` configuration value.

Solutions

  1. Set log_schema.host_key to a valid field path such as "host".
  2. Remove the custom log_schema.host_key override to restore the valid default.
  3. Check for stray whitespace or empty values coming from env-var-based config templating.

Example fix

# before (invalid)
log_schema:
  host_key: ""
# after
log_schema:
  host_key: "host"
Defensive patterns

Strategy: validation

Validate before calling

// validate before starting vector:
// vector validate --no-environment config.yaml
if !host_key.is_empty() && lookup_path(host_key).is_none() {
    eprintln!("invalid log_schema.host_key: {}", host_key);
}

Prevention

When it happens

Trigger: Starting Vector with a datadog_agent source while the global log_schema.host_key setting (or default) cannot be parsed into a valid Value path, e.g. an empty string or characters invalid for path parsing.

Common situations: Users overriding log_schema.host_key in config with an empty or malformed key like "" or "a..b"; environment-driven schema overrides producing invalid values; broken default after a version change.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@0d4ab78a4f (2026-09-16). Data as JSON: /api/errors/62d5666edc1216b4. Report an issue: GitHub.

Appendix: source

Thrown at src/sources/datadog_agent/mod.rs:476

impl DatadogAgentSource {
    pub(crate) fn new(
        store_api_key: bool,
        decoder: Decoder,
        protocol: &'static str,
        logs_schema_definition: Option<schema::Definition>,
        log_namespace: LogNamespace,
        parse_ddtags: bool,
        split_metric_namespace: bool,
    ) -> Self {
        Self {
            api_key_extractor: ApiKeyExtractor {
                store_api_key,
                matcher: Regex::new(r"^/v1/input/(?P<api_key>[[:alnum:]]{32})/??")
                    .expect("static regex always compiles"),
            },
            log_schema_host_key: log_schema()
                .host_key_target_path()
                .expect("global log_schema.host_key to be valid path")
                .clone(),
            log_schema_source_type_key: log_schema()
                .source_type_key_target_path()
                .expect("global log_schema.source_type_key to be valid path")
                .clone(),
            decoder,
            protocol,
            logs_schema_definition: logs_schema_definition.map(Arc::new),
            log_namespace,
            events_received: register!(EventsReceived),
            parse_ddtags,
            split_metric_namespace,
        }
    }

    fn build_warp_filters(
        &self,
        handler: RequestHandler,

View on GitHub (pinned to 0d4ab78a4f)