2026/07/15

今天把vector 升到 v0.57.0 後
執行時出現以下 error

/root/vector-x86_64-unknown-linux-gnu/bin/vector -c /root/vector_data/vector.yaml
2026-07-14T23:42:39.795601Z  INFO vector::app: Log level is enabled. level="info"
2026-07-14T23:42:39.796124Z  INFO vector::app: Loading configs. paths=["/root/vector_data/vector.yaml"]
2026-07-14T23:42:39.824845Z ERROR vector::topology::builder: Configuration error. error=Sink "loki_output": template references event fields (["host"]) but has no literal string prefix to derive a confinement base from. Add a static prefix to your template, or set `dangerously_allow_unconfined_template_resolution: true` to opt out. internal_log_rate_limit=false

這次改版後出錯的主因,是 Vector 為了安全性預設會檢查模板(Template Syntax, 即 {{ ... }})。當它看到 host: "{{ host }}" 時,因為前面沒有任何固定的字串字頭(Prefix),Vector 擔心會造成不安全的動態解析,所以主動擋了下來。

改一下yaml 
在 endpoint 跟 encoding 中間加上 dangerously_allow_unconfined_template_resolution


endpoint: "http://10.0.0.1:3100"

    # 加上此設定以允許無固定 Prefix 的動態 Template 解析
    dangerously_allow_unconfined_template_resolution: true

encoding:

沒有留言: