You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

自定义构建OpenTelemetry Collector缺失tcplog依赖的syslog_parser算子

解决syslog_parser算子无法在自定义OCB构建中识别的问题

问题根源

tcplog接收器依赖OpenTelemetry Stanza框架处理日志算子,但syslog_parser算子的注册代码并未默认包含在tcplogreceiver模块中。OCB构建时只会编译显式声明的模块,因此未引入该算子模块会导致配置解析时提示unsupported type 'syslog_parser'。

解决方案

在OCB配置文件中显式添加syslog_parser算子所在的模块,确保构建时将其编译进Collector。具体修改如下:

  1. 更新OCB配置文件,新增additional_mods字段,引入syslog parser模块,版本与tcplogreceiver保持一致(v0.84.0):
receivers:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/receiver/tcplogreceiver v0.84.0

additional_mods:
  - gomod: github.com/open-telemetry/opentelemetry-collector-contrib/pkg/stanza/operator/parser/syslog v0.84.0
  1. 重新使用OCB构建Collector:
ocb --config=your-config.yaml

为什么之前的replaces配置无效

replaces仅用于替换依赖包的版本,无法将未被引用的模块主动纳入构建范围。你需要显式声明要包含的算子模块,才能让OCB将其编译进最终的Collector二进制文件。

内容的提问来源于stack exchange,提问作者Jan Garaj

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.11 19:43:23